From owner-svn-src-all@FreeBSD.ORG Thu Nov 15 18:53:19 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 73BD478C for ; Thu, 15 Nov 2012 18:53:19 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id D1FAC8FC17 for ; Thu, 15 Nov 2012 18:53:18 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so1871093lah.13 for ; Thu, 15 Nov 2012 10:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=uH6ZBjAfLlSRKHMijgXCoP+JGS8/wq84wSoLBThPQ9w=; b=Y4stiXKVIhKywsBG7nv94ZFvRuVu+JFj1oq1Sa9gk6soxWGn/zPDTqk45wCjJPTGVc NLg9/Eun+KubMqHyY2izrMdfQFaV3aQv/0OZiXTKr7ie/96WbjPDF3OmiPzV03Urnqgx mpzNLPMsOM2p5dLzAP8j6aWPrwpWjuanNd+sE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=uH6ZBjAfLlSRKHMijgXCoP+JGS8/wq84wSoLBThPQ9w=; b=IiHLqETTmeZbIYfLovgJlzQdYcjSer4Clfm0KQD50Re+Cq8fjSnOaFJmVV6msLfnvu CeJ0tAOIiBWQXIvwL9WUidh1+sqD/IB3ivIxCSZg7LPZzGT4sZNgmW1CRxmDx/6FuUnm cxlDdsDJGiKdgzaiK8ZJcqL+i3NhEB/HQkwBRcfNtlyLW382dvDJfOuPoBZBEYiMvS2N HIhXkC2RUIgEa4uWicOlMYOqIN6JpFSFwDw5dgV9jR/gOPbYHYGkBGb+cMVsZps5ytoq TO+/+REYYHyI+xhxGtB1rSM0gdhVeTq2Fg+hdgnMZ+VafdXouvzqanDBERO0E2B1lQpq h9GQ== Received: by 10.112.54.40 with SMTP id g8mr1011225lbp.49.1353005597564; Thu, 15 Nov 2012 10:53:17 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.25.166 with HTTP; Thu, 15 Nov 2012 10:52:46 -0800 (PST) In-Reply-To: <20121116032851.I44199@besplex.bde.org> References: <201211151506.qAFF63v0003848@svn.freebsd.org> <20121115153030.GD73505@kib.kiev.ua> <20121116032851.I44199@besplex.bde.org> From: Eitan Adler Date: Thu, 15 Nov 2012 13:52:46 -0500 X-Google-Sender-Auth: moJfvAvd2Bz9pTOVQDopkjjDLAc Message-ID: Subject: Re: svn commit: r243076 - head/usr.sbin/chkgrp To: Bruce Evans Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlvBDsnxDZStKK5rbqdmHm86mz1GmOxptvE6JSeRuPqrBH88ShfThYkdgo88MKJngLpCtGF Cc: Konstantin Belousov , 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 18:53:19 -0000 On 15 November 2012 11:52, Bruce Evans wrote: > strtoul("1garbage", NULL, 10) succeeds and returns value 1, but the input > is garbage. This case is covered earlier 160 /* check that the GID is numeric */ 161 if (strspn(f[2], "0123456789") != strlen(f[2])) { 162 warnx("%s: line %d: GID is not numeric", gfn, n); > 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. 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. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams