grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chang <mchang@suse.com>
To: Grub devel <grub-devel@gnu.org>
Cc: Ken Lin <ken.lin@hpe.com>, Michael Chang <mchang@suse.com>
Subject: [PATCH 1/8] misc: fix invalid character recongition in strto*l
Date: Wed,  3 Aug 2016 14:34:41 +0800	[thread overview]
Message-ID: <1470206088-16151-2-git-send-email-mchang@suse.com> (raw)
In-Reply-To: <1470206088-16151-1-git-send-email-mchang@suse.com>

From: Aaron Miller <aaronmiller@fb.com>

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 d1a54df..3a14d67 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -394,9 +394,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;
 
-- 
2.6.6



  reply	other threads:[~2016-08-03  6:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03  6:34 Patches to support UEFI HTTP Boot IPv4 and IPv6 Michael Chang
2016-08-03  6:34 ` Michael Chang [this message]
2016-08-10 15:51   ` [PATCH 1/8] misc: fix invalid character recongition in strto*l Vladimir 'phcoder' Serbinenko
2016-08-03  6:34 ` [PATCH 2/8] net: read bracketed ipv6 addrs and port numbers Michael Chang
2016-08-03  8:17   ` Andrei Borzenkov
2016-08-03  6:34 ` [PATCH 3/8] bootp: New net_bootp6 command Michael Chang
2016-08-03  6:34 ` [PATCH 4/8] efinet: UEFI IPv6 PXE support Michael Chang
2016-08-03  6:34 ` [PATCH 5/8] grub.texi: Add net_bootp6 doument Michael Chang
2016-08-03  6:34 ` [PATCH 6/8] bootp: Add processing DHCPACK packet from HTTP Boot Michael Chang
2016-08-03  6:34 ` [PATCH 7/8] efinet: Setting network from UEFI device path Michael Chang
2016-08-03  6:34 ` [PATCH 8/8] efinet: Setting DNS server from UEFI protocol Michael Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470206088-16151-2-git-send-email-mchang@suse.com \
    --to=mchang@suse.com \
    --cc=grub-devel@gnu.org \
    --cc=ken.lin@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).