strtoull: Fix behaviour on chars between '9' and 'a'.
Reported by: Aaron Miller <aaronmiller@fb.com>
This commit is contained in:
parent
ede6c96893
commit
dc6e1b5af8
2 changed files with 18 additions and 8 deletions
|
@ -391,12 +391,13 @@ grub_strtoull (const char *str, char **end, int base)
|
|||
unsigned long digit;
|
||||
|
||||
digit = grub_tolower (*str) - '0';
|
||||
if (digit > 9)
|
||||
{
|
||||
digit += '0' - 'a' + 10;
|
||||
if (digit >= (unsigned long) base)
|
||||
break;
|
||||
}
|
||||
if (digit >= 'a' - '0')
|
||||
digit += '0' - 'a' + 10;
|
||||
else if (digit > 9)
|
||||
break;
|
||||
|
||||
if (digit >= (unsigned long) base)
|
||||
break;
|
||||
|
||||
found = 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue