Browse Source

[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.
tags/v0.9.4
Michael Brown 16 years ago
parent
commit
6fe585642a
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      src/core/misc.c

+ 1
- 1
src/core/misc.c View File

@@ -69,7 +69,7 @@ unsigned long strtoul ( const char *p, char **endp, int base ) {
69 69
 			charval = ( charval - 'a' + 10 );
70 70
 		} else if ( charval >= 'A' ) {
71 71
 			charval = ( charval - 'A' + 10 );
72
-		} else {
72
+		} else if ( charval <= '9' ) {
73 73
 			charval = ( charval - '0' );
74 74
 		}
75 75
 		if ( charval >= ( unsigned int ) base )

Loading…
Cancel
Save