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

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