Messages in this thread Patch in this message |  | | Subject | [PATCH] Fix sscanf | Date | Sun, 23 Sep 2001 22:54:10 -0500 | From | Jeff Dike <> |
| |
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/
|  |