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

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