Blame SOURCES/0249-misc-fix-invalid-character-recongition-in-strto-l.patch

4fe85b
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4fe85b
From: Aaron Miller <aaronmiller@fb.com>
4fe85b
Date: Fri, 29 Jul 2016 17:41:27 +0800
4fe85b
Subject: [PATCH] misc: fix invalid character recongition in strto*l
4fe85b
4fe85b
Would previously allow digits larger than the base and didn't check that
4fe85b
subtracting the difference from 0-9 to lowercase letters for characters
4fe85b
larger than 9 didn't result in a value lower than 9, which allowed the
4fe85b
parses: ` = 9, _ = 8, ^ = 7, ] = 6, \ = 5, and [ = 4
4fe85b
---
4fe85b
 grub-core/kern/misc.c | 6 +++++-
4fe85b
 1 file changed, 5 insertions(+), 1 deletion(-)
4fe85b
4fe85b
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
4fe85b
index 240396c55f3..d0ca2ee603b 100644
4fe85b
--- a/grub-core/kern/misc.c
4fe85b
+++ b/grub-core/kern/misc.c
4fe85b
@@ -436,9 +436,13 @@ grub_strtoull (const char *str, char **end, int base)
4fe85b
       if (digit > 9)
4fe85b
 	{
4fe85b
 	  digit += '0' - 'a' + 10;
4fe85b
-	  if (digit >= (unsigned long) base)
4fe85b
+	  /* digit <= 9 check is needed to keep chars larger than
4fe85b
+	     '9' but less than 'a' from being read as numbers */
4fe85b
+	  if (digit >= (unsigned long) base || digit <= 9)
4fe85b
 	    break;
4fe85b
 	}
4fe85b
+      if (digit >= (unsigned long) base)
4fe85b
+	break;
4fe85b
 
4fe85b
       found = 1;
4fe85b