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
 			charval = ( charval - 'a' + 10 );
69
 			charval = ( charval - 'a' + 10 );
70
 		} else if ( charval >= 'A' ) {
70
 		} else if ( charval >= 'A' ) {
71
 			charval = ( charval - 'A' + 10 );
71
 			charval = ( charval - 'A' + 10 );
72
-		} else {
72
+		} else if ( charval <= '9' ) {
73
 			charval = ( charval - '0' );
73
 			charval = ( charval - '0' );
74
 		}
74
 		}
75
 		if ( charval >= ( unsigned int ) base )
75
 		if ( charval >= ( unsigned int ) base )

Loading…
Cancel
Save