From owner-svn-src-all@FreeBSD.ORG Thu Nov 15 15:30:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A3E11EC6; Thu, 15 Nov 2012 15:30:48 +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 966708FC0C; Thu, 15 Nov 2012 15:30:44 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qAFFUUNj055266; Thu, 15 Nov 2012 17:30:30 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qAFFUUNj055266 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qAFFUUiV055265; Thu, 15 Nov 2012 17:30:30 +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 17:30:30 +0200 From: Konstantin Belousov To: Eitan Adler Subject: Re: svn commit: r243076 - head/usr.sbin/chkgrp Message-ID: <20121115153030.GD73505@kib.kiev.ua> References: <201211151506.qAFF63v0003848@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vAuP2vENPacJU4tn" Content-Disposition: inline In-Reply-To: <201211151506.qAFF63v0003848@svn.freebsd.org> 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 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 15:30:48 -0000 --vAuP2vENPacJU4tn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 15, 2012 at 03:06:03PM +0000, Eitan Adler wrote: > Author: eadler > Date: Thu Nov 15 15:06:03 2012 > New Revision: 243076 > URL: http://svnweb.freebsd.org/changeset/base/243076 >=20 > Log: > Check the range of the gid > =20 > Approved by: cperciva > MFC after: 1 week >=20 > Modified: > head/usr.sbin/chkgrp/chkgrp.c >=20 > Modified: head/usr.sbin/chkgrp/chkgrp.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/chkgrp/chkgrp.c Thu Nov 15 15:06:00 2012 (r243075) > +++ head/usr.sbin/chkgrp/chkgrp.c Thu Nov 15 15:06:03 2012 (r243076) > @@ -30,7 +30,10 @@ > __FBSDID("$FreeBSD$"); > =20 > #include > +#include > #include > +#include > +#include > #include > #include > #include > @@ -150,6 +153,18 @@ main(int argc, char *argv[]) > warnx("%s: line %d: GID is not numeric", gfn, n); > e++; > } > + > + /* check the range of the group id */ > + errno =3D 0; > + unsigned long groupid =3D strtoul(f[2], NULL, 10); And this violates style. The checks for strtoul failure are not exhaustive. > + if (errno !=3D 0) { > + warnx("%s: line %d: strtoul failed", gfn, n); > + } > + else if (groupid > GID_MAX) { > + warnx("%s: line %d: group id is too large (> %ju)", > + gfn, n, (uintmax_t)GID_MAX); > + e++; > + } > =09 > #if 0 > /* entry is correct, so print it */ --vAuP2vENPacJU4tn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlClCpYACgkQC3+MBN1Mb4h+UQCdFCogE7/C8sllwbqEsB/TQcRG UFUAoJql4ZcK0jdkFsz/tt04dhITk6Bu =bXBb -----END PGP SIGNATURE----- --vAuP2vENPacJU4tn--