From owner-freebsd-current@FreeBSD.ORG Thu Jan 20 22:11:56 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 79B3216A4CE; Thu, 20 Jan 2005 22:11:56 +0000 (GMT) Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8566043D1F; Thu, 20 Jan 2005 22:11:55 +0000 (GMT) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.13.1/8.13.1) with ESMTP id j0KMBsD6071265; Fri, 21 Jan 2005 01:11:54 +0300 (MSK) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.13.1/8.13.1/Submit) id j0KMBsWm071264; Fri, 21 Jan 2005 01:11:54 +0300 (MSK) (envelope-from ache) Date: Fri, 21 Jan 2005 01:11:54 +0300 From: Andrey Chernov To: Joerg Wunsch , current@FreeBSD.ORG, bde@FreeBSD.ORG Message-ID: <20050120221154.GC70629@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Joerg Wunsch , current@FreeBSD.ORG, bde@FreeBSD.ORG References: <20050120192324.GA30862@uriah.heep.sax.de> <20050120205501.GA69123@nagual.pp.ru> <20050120211449.GC30862@uriah.heep.sax.de> <20050120214406.GA70088@nagual.pp.ru> <20050120215807.GA70629@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050120215807.GA70629@nagual.pp.ru> User-Agent: Mutt/1.5.6i X-AntiVirus: checked by AntiVir Milter (version: 1.1.0-3; AVE: 6.29.0.8; VDF: 6.29.0.73; host: nagual.pp.ru) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.6 (nagual.pp.ru [0.0.0.0]); Fri, 21 Jan 2005 01:11:54 +0300 (MSK) Subject: [patch] Re: Implementation errors in strtol() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2005 22:11:56 -0000 On Fri, Jan 21, 2005 at 12:58:07AM +0300, Andrey Chernov wrote: > "If the value of base is 16, the characters 0x or 0X may optionally > ^^^^^^^^^^^ > precede the sequence of letters and digits, following the sign if > present." Here is untested patch to fix the problem: --- strtol.c.bak Fri Jan 21 01:06:06 2005 +++ strtol.c Fri Jan 21 01:09:30 2005 @@ -76,7 +76,11 @@ c = *s++; } if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { + c == '0' && (*s == 'x' || *s == 'X') && + (s[1] >= 'a' && s[1] <= 'f' || + s[1] >= 'A' && s[1] <= 'F' || + s[1] >= '0' && s[1] <= '9') + ) { c = s[1]; s += 2; base = 16; -- http://ache.pp.ru/