lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <155223699117.4075.8079162387262586958.stgit@buzz>
Date:   Sun, 10 Mar 2019 19:56:31 +0300
From:   Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To:     linux-kernel@...r.kernel.org
Cc:     Tejun Heo <tj@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH v1 1/6] lib: scanf: document features of scanf format string

Kernel implementation of vsscanf() has some limitations.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
---
 lib/vsprintf.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 791b6fa36905..276a0bc3b019 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3004,6 +3004,28 @@ EXPORT_SYMBOL_GPL(bprintf);
  * @buf:	input buffer
  * @fmt:	format of buffer
  * @args:	arguments
+ *
+ * Returns number of successfully matched arguments.
+ *
+ * This function implements only basic vsscanf features:
+ *
+ * - conversion specifiers: d, i, o, u, x, X, s, c, [, n
+ * - type modifiers: hh, h, l, L, ll, z
+ *
+ * Not implemented features:
+ *
+ * - floating-point numbers
+ * - memory-allocation "%m..."
+ * - pointer "%p", ptrdiff_t "%t...", intmax_t "%j..."
+ * - discaring of matching input "%*[...]"
+ * - ranges or matching ']' in "%[...]"
+ * - positional assignment "%n$"
+ *
+ * Non-standatd features:
+ *
+ * - "%[...]" requires field width
+ * - %s without field width limited with SHRT_MAX
+ * - "%*..." simply skips non white-space characters without conversion
  */
 int vsscanf(const char *buf, const char *fmt, va_list args)
 {
@@ -3291,6 +3313,12 @@ EXPORT_SYMBOL(vsscanf);
  * @buf:	input buffer
  * @fmt:	formatting of buffer
  * @...:	resulting arguments
+ *
+ * Returns number of successfully matched arguments.
+ *
+ * See format description in comment for vsscanf() above.
+ *
+ * For single integer conversion it is better to use kstrto*().
  */
 int sscanf(const char *buf, const char *fmt, ...)
 {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ