mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-22 15:22:39 +00:00
strtoull: Fix behaviour on chars between '9' and 'a'.
Reported by: Aaron Miller <aaronmiller@fb.com>
This commit is contained in:
1 parent
b4fc7bc2fd
commit
9ac0dca085
3 files changed
+20
-5
No files matched your search
@@ -1958,6 +1958,11 @@ module = {
|
|||||||
common = tests/example_functional_test.c;
|
common = tests/example_functional_test.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = strtoull_test;
|
||||||
|
common = tests/strtoull_test.c;
|
||||||
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = setjmp_test;
|
name = setjmp_test;
|
||||||
common = tests/setjmp_test.c;
|
common = tests/setjmp_test.c;
|
||||||
|
|||||||
@@ -391,12 +391,13 @@ grub_strtoull (const char *str, char **end, int base)
|
|||||||
unsigned long digit;
|
unsigned long digit;
|
||||||
|
|
||||||
digit = grub_tolower (*str) - '0';
|
digit = grub_tolower (*str) - '0';
|
||||||
if (digit > 9)
|
if (digit >= 'a' - '0')
|
||||||
{
|
|
||||||
digit += '0' - 'a' + 10;
|
digit += '0' - 'a' + 10;
|
||||||
|
else if (digit > 9)
|
||||||
|
break;
|
||||||
|
|
||||||
if (digit >= (unsigned long) base)
|
if (digit >= (unsigned long) base)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -26,14 +26,23 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)),
|
grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc,
|
||||||
char **args __attribute__ ((unused)))
|
char **args)
|
||||||
{
|
{
|
||||||
grub_test_t test;
|
grub_test_t test;
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
|
int i;
|
||||||
|
|
||||||
FOR_LIST_ELEMENTS (test, grub_test_list)
|
FOR_LIST_ELEMENTS (test, grub_test_list)
|
||||||
{
|
{
|
||||||
|
if (argc != 0)
|
||||||
|
{
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
if (grub_strcmp(args[i], test->name) == 0)
|
||||||
|
break;
|
||||||
|
if (i == argc)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
grub_errno = 0;
|
grub_errno = 0;
|
||||||
ok = ok && !grub_test_run (test);
|
ok = ok && !grub_test_run (test);
|
||||||
grub_errno = 0;
|
grub_errno = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user