grub2/0110-misc-fix-invalid-character-recongition-in-strto-l.patch
Javier Martinez Canillas e1531466e1
Update to grub 2.04
This change updates grub to the 2.04 release. The new release changed how
grub is built, so the bootstrap and bootstrap.conf files have to be added
to the dist-git. Also, the gitignore file changed so it has to be updated.

Since the patches have been forward ported to 2.04, there's no need for a
logic to maintain a patch with the delta between the release and the grub
master branch. So the release-to-master.patch is dropped and no longer is
updated by the do-rebase script.

Also since gnulib isn't part of the grub repository anymore and cloned by
the boostrap tool, a gnulib tarball is included as other source file and
copied before calling the bootstrap tool. That way grub can be built even
in builders that only have access to the sources lookaside cache.

Resolves: rhbz#1727279

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2019-08-15 08:04:53 +02:00

37 lines
1.2 KiB
Diff

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 | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 0e89c483d5e..5c3899f0e5b 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -434,11 +434,14 @@ grub_strtoull (const char *str, char **end, int base)
unsigned long digit;
digit = grub_tolower (*str) - '0';
- if (digit >= 'a' - '0')
- digit += '0' - 'a' + 10;
- else if (digit > 9)
- break;
-
+ if (digit > 9)
+ {
+ digit += '0' - 'a' + 10;
+ /* 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;