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-next>] [day] [month] [year] [list]
Message-ID: <20090925062734.GA9318@c.hsd1.tn.comcast.net>
Date:	Fri, 25 Sep 2009 06:27:34 +0000
From:	Andy Spencer <andy753421@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] fix %*s%n in sscanf

When using %*s, sscanf should honor conversion specifiers immediately following
the %*s. For example, the following code should find the position of the end of
the string "hello".

  int end;
  char buf[] = "hello    world";
  sscanf(buf, "%*s%n", &end);
  printf("%d\n", end);

Ideally, sscanf would advance the fmt and str pointers the same as it would
without the *, but the code for that is rather complicated and is not included
in the patch.

Please CC me in replies.


Signed-off-by: Andy Spencer <andy753421@...il.com>

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 73a14b8..da2daf2 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1766,7 +1766,7 @@ int vsscanf(const char * buf, const char * fmt, va_list args)
 		 * advance both strings to next white space
 		 */
 		if (*fmt == '*') {
-			while (!isspace(*fmt) && *fmt)
+			while (!isspace(*fmt) && *fmt != '%' && *fmt)
 				fmt++;
 			while (!isspace(*str) && *str)
 				str++;

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ