瀏覽代碼

[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 年之前
父節點
當前提交
6fe585642a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      src/core/misc.c

+ 1
- 1
src/core/misc.c 查看文件

@@ -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…
取消
儲存