Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sscanf(): fix %*s%n

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.

Signed-off-by: Andy Spencer <andy753421@gmail.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andy Spencer and committed by
Linus Torvalds
8fccae2c d41a4b51

+1 -1
+1 -1
lib/vsprintf.c
··· 1771 1771 * advance both strings to next white space 1772 1772 */ 1773 1773 if (*fmt == '*') { 1774 - while (!isspace(*fmt) && *fmt) 1774 + while (!isspace(*fmt) && *fmt != '%' && *fmt) 1775 1775 fmt++; 1776 1776 while (!isspace(*str) && *str) 1777 1777 str++;