Messages in this thread Patch in this message | | | Date | Tue, 23 Sep 2003 14:22:07 -0700 | From | Deepak Saxena <> | Subject | [PATCH] Fix %x parsing in vsscanf() |
| |
The existing code in kernel/vsprintf.c:vsscanf() does not properly handle the case where the format is specfied as %x or %X and the string contains the number in the format "0xinteger". Instead of reading "0xinteger", the code currently only sees the '0' and treats the 'x' as a delimiter. Following patch (against 2.4 and 2.6) fixes this. Another option is to put the check in simple_strtoul() and simple_strtoull() if that is preferred. I like this better b/c we only have the check once.
Please apply, ~Deepak
===== lib/vsprintf.c 1.2 vs edited ===== --- 1.2/lib/vsprintf.c Mon Aug 11 04:54:01 2003 +++ edited/lib/vsprintf.c Tue Sep 23 13:50:50 2003 @@ -615,6 +615,8 @@ case 'x': case 'X': base = 16; + if(str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + str += 2; break; case 'd': case 'i':
-- Deepak Saxena MontaVista Software - Powering the Embedded Revolution - www.mvista.com - 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/
| |