Pārlūkot izejas kodu

[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 gadus atpakaļ
vecāks
revīzija
6fe585642a
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1
    1
      src/core/misc.c

+ 1
- 1
src/core/misc.c Parādīt failu

@@ -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 )

Notiek ielāde…
Atcelt
Saglabāt