Received: from list by lists.gnu.org with archive (Exim 4.71) id 1awDqq-00058O-Ih for mharc-grub-devel@gnu.org; Fri, 29 Apr 2016 15:13:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awDqi-0004tb-OO for grub-devel@gnu.org; Fri, 29 Apr 2016 15:13:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1awDqW-0003pX-Ne for grub-devel@gnu.org; Fri, 29 Apr 2016 15:13:07 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:14630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awDqS-0003eI-Ua for grub-devel@gnu.org; Fri, 29 Apr 2016 15:13:00 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u3TJ8klC024296 for ; Fri, 29 Apr 2016 12:12:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=facebook; bh=8IUYQtWb1sjl+8nzZNNPs189Zoe6CERjOgM3lStE4/c=; b=f6QDX6tN7YkBDYnMv2q7vM25yRBDcjWfEyiJ6C9z8+Nin2HyjEd4TxvRNTREXOA4oJR5 aJ9OEYS5W8nuABMvyku+rr+qRknaVoU7nZuMLgOOsXlvV/5Cyr82F0Jkn0Yh0yr/8gdE QPhsakpBd5fCfKuZIoiFmtkZ0cL4JqVozYU= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 22ktt2q2ha-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 29 Apr 2016 12:12:44 -0700 Received: from [192.168.64.1] (192.168.52.123) by mail.TheFacebook.com (192.168.16.18) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 29 Apr 2016 12:12:42 -0700 From: Aaron Miller To: The development of GNU GRUB Subject: Re: [PATCH 1/2] misc: fix invalid character recongition in strto*l Date: Fri, 29 Apr 2016 12:12:42 -0700 Message-ID: <0579F106-64A6-44F1-81B4-054EBFFABFC9@fb.com> In-Reply-To: <57224FF8.1010203@gmail.com> References: <63E370CE-24D3-45C8-AD09-506DFC023F35@fb.com> <0EB0A511-382A-4B85-8F09-1163009CA653@fb.com> <57224FF8.1010203@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed X-Mailer: MailMate (1.9.4r5234) X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-04-29_10:, , signatures=0 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by m0001303.ppops.net id u3TJ8klC024296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 67.231.153.30 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 19:13:19 -0000 On 28 Apr 2016, at 11:01, Andrei Borzenkov wrote: > 28.04.2016 03:53, Aaron Miller =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> Would previously allow digits larger than the base and didn't check=20 >> that >> subtracting the difference from 0-9 to lowercase letters for=20 >> characters >> larger than 9 didn't result in a value lower than 9, which allowed=20 >> the >> parses: ` =3D 9, _ =3D 8, ^ =3D 7, ] =3D 6, \ =3D 5, and [ =3D 4 > > Does it cause any real problem (i.e. is it 2.02 material)? > With the later patch I sent (allowing port numbers including=20 "[ipv6:addr]:port"), it is needed to keep something like "0000]" from=20 being parsed as 6. I don't know of any case without that where it can=20 cause a problem -- would be any case where a number being read is=20 followed by any of `_^]\[ >> --- >> >> Need to move the out-of-base check to *after* the outside [0-9]=20 >> handling >> or this breaks. >> >> grub-core/kern/misc.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c >> index 906d2c2..3653d4d 100644 >> --- a/grub-core/kern/misc.c >> +++ b/grub-core/kern/misc.c >> @@ -394,9 +394,11 @@ grub_strtoull (const char *str, char **end, int=20 >> base) >> if (digit > 9) >> { >> digit +=3D '0' - 'a' + 10; >> - if (digit >=3D (unsigned long) base) >> + if (digit >=3D (unsigned long) base || digit <=3D 9) > > base comparison becomes redundant here. And this needs comment > explaining digit <=3D 9 comparison for future reference. > Will resend with a comment -- this and the below are both needed when=20 for example base=3D8 and digit is '9' or '8' and should still be rejected= .=20 digit <=3D 9 is needed to prevent the '` =3D 9, _ =3D 8, ^ =3D 7, ] =3D 6= , \ =3D 5,=20 [ =3D 4' problem. >> break; >> } >> + if (digit >=3D (unsigned long) base) >> + break; >> >> found =3D 1; >> > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel