You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
|
From: Aaron Miller <aaronmiller@fb.com> |
|
Date: Fri, 29 Jul 2016 17:41:27 +0800 |
|
Subject: [PATCH] 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 |
|
--- |
|
grub-core/kern/misc.c | 6 +++++- |
|
1 file changed, 5 insertions(+), 1 deletion(-) |
|
|
|
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c |
|
index 240396c55f3..d0ca2ee603b 100644 |
|
--- a/grub-core/kern/misc.c |
|
+++ b/grub-core/kern/misc.c |
|
@@ -436,9 +436,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; |
|
|
|
|