summaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorAndy Spencer <andy753421@gmail.com>2009-10-02 00:44:27 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-10-02 01:11:16 +0200
commit8fccae2c95506270f74ee8429c273b0924e89c83 (patch)
tree0d7147c02cda1ae3476698808957477569160c00 /lib/vsprintf.c
parentserial: add parameter to force skipping the test for the TXEN bug (diff)
downloadlinux-8fccae2c95506270f74ee8429c273b0924e89c83.tar.xz
linux-8fccae2c95506270f74ee8429c273b0924e89c83.zip
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>
Diffstat (limited to '')
-rw-r--r--lib/vsprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b91839e9e892..33bed5e67a21 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1771,7 +1771,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++;