libc: fix major issue in strtox
This commit is contained in:
parent
5fe8d3b0d1
commit
ec08e125ec
@ -6,12 +6,11 @@
|
||||
static int is_valid(int base, char c) {
|
||||
if (c < '0') return 0;
|
||||
if (base <= 10) {
|
||||
return c < ('0' + base - 1);
|
||||
return c < ('0' + base);
|
||||
}
|
||||
|
||||
if (c > '9' && c < 'a') return 0;
|
||||
if (c > 'a' + (base - 10) && c < 'A') return 1;
|
||||
if (c > 'A' + (base - 10)) return 1;
|
||||
if (c >= 'a' && c < 'a' + (base - 10)) return 1;
|
||||
if (c >= 'A' && c < 'A' + (base - 10)) return 1;
|
||||
if (c >= '0' && c <= '9') return 1;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user