From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2584 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: minor issues (found by cppcheck) Date: Mon, 14 Jan 2013 22:23:50 +0100 Message-ID: <20130114212350.GX4468@port70.net> References: <20130114194147.GW4468@port70.net> <20130114210541.GQ20323@brightrain.aerifal.cx> 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: ger.gmane.org 1358198643 11877 80.91.229.3 (14 Jan 2013 21:24:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Jan 2013 21:24:03 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2585-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 14 22:24:21 2013 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 1TurVy-0007tN-Bd for gllmg-musl@plane.gmane.org; Mon, 14 Jan 2013 22:24:18 +0100 Original-Received: (qmail 29749 invoked by uid 550); 14 Jan 2013 21:24:01 -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 29733 invoked from network); 14 Jan 2013 21:24:01 -0000 Content-Disposition: inline In-Reply-To: <20130114210541.GQ20323@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2584 Archived-At: * Rich Felker [2013-01-14 16:05:41 -0500]: > On Mon, Jan 14, 2013 at 08:41:47PM +0100, Szabolcs Nagy wrote: > > getmntent_r has a sscanf with %d, > > it might make sense to limit the width > > I think the error is irrelevant for %d unless we're talking about the > theoretical UB for integer overflow, but that doesn't seem to be what > this warning is about. Anyway, musl's scanf has well-defined overflow > behavior. i mean if there is a very long digit sequence in the input it may make sense to fail early, eg use %11d and with a final %n we could check if the input is read correctly assuming we want to report failure on invalid input