Received: from list by lists.gnu.org with archive (Exim 4.71) id 1avXQ7-0003ks-AI for mharc-grub-devel@gnu.org; Wed, 27 Apr 2016 17:54:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avXQ5-0003hH-1o for grub-devel@gnu.org; Wed, 27 Apr 2016 17:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avXQ1-0000Ub-RK for grub-devel@gnu.org; Wed, 27 Apr 2016 17:54:52 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:60086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avXQ1-0000UL-J4 for grub-devel@gnu.org; Wed, 27 Apr 2016 17:54:49 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u3RLpZ0c012237 for ; Wed, 27 Apr 2016 14:54:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=0kgA1dcJ7PJklsjcwqJ9DOeo9QYzIynKcz4D4ns00Vc=; b=Eg1LgBwPvZEphtYyfguDZpkhH4Q7oboeX53yFH/5TJ/Q5Rtesf8Zl8VUipR4acwkPVlu NUHpT1ktIN28SrJ48x3FQylslmPPR5RzMZB+VF1SKD7oOlRzUX6b9U9eoTM4iT9Ea5w1 CtPctm11FVOMzJMXW8Aky5hiz6M2aMHvnnk= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 22k36dgt1x-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for ; Wed, 27 Apr 2016 14:54:48 -0700 Received: from [192.168.64.1] (192.168.52.123) by mail.thefacebook.com (192.168.16.24) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 27 Apr 2016 14:54:47 -0700 From: Aaron Miller To: Subject: [PATCH 1/2] misc: fix invalid character recongition in strto*l Date: Wed, 27 Apr 2016 14:54:46 -0700 Message-ID: <63E370CE-24D3-45C8-AD09-506DFC023F35@fb.com> MIME-Version: 1.0 Content-Type: text/plain; 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-27_12:, , signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 67.231.145.42 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: Wed, 27 Apr 2016 21:54:54 -0000 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 --- Missed the >= vs < in the previously sent patch (I caught this, but then still mailed the broken patch) 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..1c0c913 100644 --- a/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c @@ -391,10 +391,12 @@ grub_strtoull (const char *str, char **end, int base) unsigned long digit; digit = grub_tolower (*str) - '0'; + if (digit >= (unsigned long) base) + break; if (digit > 9) { digit += '0' - 'a' + 10; - if (digit >= (unsigned long) base) + if (digit >= (unsigned long) base || digit <= 9) break; } -- 2.8.0.rc2