lkml.org 
[lkml]   [2001]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] Fix sscanf
Date
From
sscanf double-increments fmt in a couple of places, causing format characters
to be skipped. Patch follows.

I'm a bit unhappy about the second chunk, but I don't see a cleaner way to
do it offhand.

Jeff

--- orig/lib/vsprintf.c Sun Sep 23 19:20:54 2001
+++ 2.4.10/lib/vsprintf.c Sun Sep 23 21:28:55 2001
@@ -530,7 +530,8 @@

/* anything that is not a conversion must match exactly */
if (*fmt != '%') {
- if (*fmt++ != *str++)
+ /* Don't bump fmt because the for header will do it */
+ if (*fmt != *str++)
return num;
continue;
}
@@ -542,6 +543,10 @@
if (*fmt == '*') {
while (!isspace(*fmt))
fmt++;
+ /* Back it up one because the for header will move it
+ * it forward again
+ */
+ fmt--;
while(!isspace(*str))
str++;
continue;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.063 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site