From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/645 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: scanf %x bug Date: Tue, 13 Mar 2012 11:05:31 -0400 Message-ID: <20120313150531.GS184@brightrain.aerifal.cx> References: <20120313135118.GD5728@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1331651140 15417 80.91.229.3 (13 Mar 2012 15:05:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Mar 2012 15:05:40 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-646-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 13 16:05:39 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1S7TI4-0001RV-TQ for gllmg-musl@plane.gmane.org; Tue, 13 Mar 2012 16:05:33 +0100 Original-Received: (qmail 30043 invoked by uid 550); 13 Mar 2012 15:05:32 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 30031 invoked from network); 13 Mar 2012 15:05:32 -0000 Content-Disposition: inline In-Reply-To: <20120313135118.GD5728@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:645 Archived-At: On Tue, Mar 13, 2012 at 02:51:18PM +0100, Szabolcs Nagy wrote: > i found a scanf bug: > > #include > int main(){ > int n, a=7; > n = sscanf("0", "%x", &a); > printf("%d %d\n", n, a); > return 0; > } > > prints 0 7 > instead of 1 0 Bleh, musl's scanf is really bad but I don't feel like rewriting it... Maybe I'll see if I can do that at the same time I replace the strtod code (which scanf will need to use). In the mean time I'll see if there's a fix for this specific issue. Have you found the corner case that triggers it? Rich