public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* (v)sscanf handles %i improperly (+patch)
@ 2002-01-07 21:27 Vladimir Kondratiev
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Kondratiev @ 2002-01-07 21:27 UTC (permalink / raw)
  To: linux-kernel

Sorry for 2-nd posting, but I'm afraid 1-st one was lost. Or is the 
issue itself not relevant? Anyway,

I found (v)sscanf included in last kernels handles %i format improperly.
Currently, up to 2.4.17, %i is handled identical to %d. However,
accordingly to man for sscanf,

        i      Matches an  optionally  signed  integer;  the  next
               pointer  must  be a pointer to int.  The integer is
               read in base 16 if it begins with `0x' or `0X',  in
               base 8 if it begins with `0', and in base 10 other­
               wise.  Only characters that correspond to the  base
               are used.


Please, when replying, CC me: mailto:vladimir.kondratiev@intel.com

Patch is quite small (against 2.4.17):

--- vsprintf.c.orig    Thu Oct 11 20:17:22 2001
+++ vsprintf.c    Tue Dec 25 23:29:31 2001
@@ -616,8 +616,9 @@
          case 'X':
              base = 16;
              break;
-        case 'd':
          case 'i':
+            base = 0; /* autodetect */
+        case 'd':
              is_sign = 1;
          case 'u':
              break;



^ permalink raw reply	[flat|nested] 2+ messages in thread
* (v)sscanf handles %i improperly (+patch)
@ 2001-12-25 21:46 Vladimir Kondratiev
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Kondratiev @ 2001-12-25 21:46 UTC (permalink / raw)
  To: linux-kernel

I found (v)sscanf included in last kernels handles %i format improperly. 
Currently, up to 2.4.17, %i is handled identical to %d. However, 
accordingly to man for sscanf,

       i      Matches an  optionally  signed  integer;  the  next
              pointer  must  be a pointer to int.  The integer is
              read in base 16 if it begins with `0x' or `0X',  in
              base 8 if it begins with `0', and in base 10 other­
              wise.  Only characters that correspond to the  base
              are used.

Please, when replying, CC me: mailto:vladimir.kondratiev@intel.com

Patch is quite small (against 2.4.17):

--- vsprintf.c.orig    Thu Oct 11 20:17:22 2001
+++ vsprintf.c    Tue Dec 25 23:29:31 2001
@@ -616,8 +616,9 @@
         case 'X':
             base = 16;
             break;
-        case 'd':
         case 'i':
+            base = 0; /* autodetect */
+        case 'd':
             is_sign = 1;
         case 'u':
             break;



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-07 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-07 21:27 (v)sscanf handles %i improperly (+patch) Vladimir Kondratiev
  -- strict thread matches above, loose matches on Subject: below --
2001-12-25 21:46 Vladimir Kondratiev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox