From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2583 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: minor issues (found by cppcheck) Date: Mon, 14 Jan 2013 16:05:41 -0500 Message-ID: <20130114210541.GQ20323@brightrain.aerifal.cx> References: <20130114194147.GW4468@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: ger.gmane.org 1358197553 969 80.91.229.3 (14 Jan 2013 21:05:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Jan 2013 21:05:53 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2584-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 14 22:06:11 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 1TurER-0000z0-13 for gllmg-musl@plane.gmane.org; Mon, 14 Jan 2013 22:06:11 +0100 Original-Received: (qmail 21913 invoked by uid 550); 14 Jan 2013 21:05:54 -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 21905 invoked from network); 14 Jan 2013 21:05:54 -0000 Content-Disposition: inline In-Reply-To: <20130114194147.GW4468@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2583 Archived-At: On Mon, Jan 14, 2013 at 08:41:47PM +0100, Szabolcs Nagy wrote: > i fixed some minor issues in my repo which were found by cppcheck > here is a list of the non-fixed ones: > > > [src/misc/mntent.c:32]: (portability) scanf without field width > limits can crash with huge input data This looks bogus. %s and %[ are used only with the * modifier which inhibits storage. > 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. > [src/regex/regcomp.c:2032]: (performance) Variable 'status' is reassigned a value before the old one has been used. > [src/regex/regcomp.c:3133]: (warning) Redundant assignment of 'errcode' to itself. > [src/regex/regcomp.c:2060]: (style) Variable 'minimal_tag' is assigned a value that is never used. > [src/regex/regcomp.c:108]: (style) struct or union member 'Anonymous1::params' is never used. > [src/regex/regcomp.c:2803]: (error) Uninitialized variable: params > > some of these occure multiple times, > the last two is probably worth fixing: > u.params in tre_literal_t struct is never used > and in the tre_match_empty function the params > argument is never used, but an uninitialized > pointer is passed anyway Indeed, these should be fixed. > [src/locale/strfmon.c:33]: (style) Variable 'fill' is assigned a value that is never used. > [src/stdio/vfscanf.c:134]: (style) Variable 'alloc' is assigned a value that is never used. > [src/stdio/vfwscanf.c:144]: (style) Variable 'alloc' is assigned a value that is never used. > > these are examples of unused values but they > all seem to be innocent They're all cases of unimplemented features, so the code should not be removed, but rather finished. :-) Rich