Explorar el Código

[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 hace 16 años
padre
commit
6fe585642a
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1
    1
      src/core/misc.c

+ 1
- 1
src/core/misc.c Ver fichero

@@ -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…
Cancelar
Guardar