From 6fe585642a79c071ed3657547acc9d4133c7abf8 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 18 Mar 2008 03:14:05 +0000 Subject: [PATCH] [libc] Fix a validation bug in strtoul() strtoul() was accepting the characters immediately above ASCII 0..9 as valid hex digits, due to a missing comparison. --- src/core/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/misc.c b/src/core/misc.c index a54f5a10..1f51272d 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -69,7 +69,7 @@ unsigned long strtoul ( const char *p, char **endp, int base ) { charval = ( charval - 'a' + 10 ); } else if ( charval >= 'A' ) { charval = ( charval - 'A' + 10 ); - } else { + } else if ( charval <= '9' ) { charval = ( charval - '0' ); } if ( charval >= ( unsigned int ) base )