mirror of
https://git.proxmox.com/git/grub2
synced 2025-10-29 20:43:10 +00:00
misc: fix invalid character recongition in strto*l
Would previously allow digits larger than the base and didn't check that subtracting the difference from 0-9 to lowercase letters for characters larger than 9 didn't result in a value lower than 9, which allowed the parses: ` = 9, _ = 8, ^ = 7, ] = 6, \ = 5, and [ = 4 Patch-Name: misc-fix-invalid-char-strtol.patch
This commit is contained in:
parent
94166a6219
commit
f8bd1b8aef
@ -394,9 +394,13 @@ grub_strtoull (const char *str, char **end, int base)
|
||||
if (digit > 9)
|
||||
{
|
||||
digit += '0' - 'a' + 10;
|
||||
if (digit >= (unsigned long) base)
|
||||
/* digit <= 9 check is needed to keep chars larger than
|
||||
'9' but less than 'a' from being read as numbers */
|
||||
if (digit >= (unsigned long) base || digit <= 9)
|
||||
break;
|
||||
}
|
||||
if (digit >= (unsigned long) base)
|
||||
break;
|
||||
|
||||
found = 1;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user