From owner-svn-src-head@FreeBSD.ORG Thu Nov 15 19:00:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D670EAE5; Thu, 15 Nov 2012 19:00:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 353AF8FC0C; Thu, 15 Nov 2012 19:00:02 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qAFIxwX3075328; Thu, 15 Nov 2012 20:59:58 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qAFIxwX3075328 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qAFIxwFZ075327; Thu, 15 Nov 2012 20:59:58 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 15 Nov 2012 20:59:58 +0200 From: Konstantin Belousov To: Eitan Adler Subject: Re: svn commit: r243076 - head/usr.sbin/chkgrp Message-ID: <20121115185958.GG73505@kib.kiev.ua> References: <201211151506.qAFF63v0003848@svn.freebsd.org> <20121115153030.GD73505@kib.kiev.ua> <20121116032851.I44199@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WGeo2zNsisDTqWWq" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 19:00:02 -0000 --WGeo2zNsisDTqWWq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 15, 2012 at 01:52:46PM -0500, Eitan Adler wrote: > On 15 November 2012 11:52, Bruce Evans wrote: > > strtoul("1garbage", NULL, 10) succeeds and returns value 1, but the inp= ut > > is garbage. >=20 > This case is covered earlier > 160 /* check that the GID is numeric */ > 161 if (strspn(f[2], "0123456789") !=3D strlen(f[2])) { > 162 warnx("%s: line %d: GID is not numeric", gfn, n); So this code shall be removed, if you are introducing strtoul() to check for errors at all. >=20 > > As the man page says, the EINVAL feature is unportable. It is almost > > useless, since to detect garbage after the number you have to pass an > > endptr to strtoul(), and then the check for no conversion (that is, > > for garbage at the beginning) is just as easy as the check for garbage > > at the end. >=20 > This patch doesn't care about EINVAL or ERANGE. It just cares strtoul > returned an error. > I even considered just ignoring the error case because the data is > mostly sanity checked prior. >=20 >=20 > --=20 > Eitan Adler > Source, Ports, Doc committer > Bugmeister, Ports Security teams --WGeo2zNsisDTqWWq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlClO6wACgkQC3+MBN1Mb4j68gCcCkKuzH+Duqtd6L47zhlq7OUB WdUAn2R7YHYJDcDMK9t6C588f1KRr4+S =iJkd -----END PGP SIGNATURE----- --WGeo2zNsisDTqWWq--