All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sscanf doesn't handle %x in 2.4.20
@ 2002-12-13 16:47 steven pratt
  0 siblings, 0 replies; only message in thread
From: steven pratt @ 2002-12-13 16:47 UTC (permalink / raw)
  To: linux-kernel, alan, marcelo; +Cc: slpratt

In vsscanf in vsprintf.c incorectly uses isdigit to check for a leading 
numeric
after finding a %x and setting the base to 16.   This breaks device 
mapper under
certain conditions.   Following patch is backport from 2.5.50.

--- vsprintf.c    Thu Oct 11 13:17:22 2001
+++ /usr/src/linux-2.4.20/lib/vsprintf.c    Fri Dec 13 09:57:14 2002
@@ -637,7 +637,11 @@
         while (isspace(*str))
             str++;
 
-        if (!*str || !isdigit(*str))
+        if (!*str
+                    || (base == 16 && !isxdigit(*str))
+                    || (base == 10 && !isdigit(*str))
+                    || (base == 8 && (!isdigit(*str) || *str > '7'))
+                    || (base == 0 && !isdigit(*str)))
             break;
 
         switch(qualifier) {



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-13 16:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-13 16:47 [PATCH] sscanf doesn't handle %x in 2.4.20 steven pratt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.