From owner-svn-src-head@FreeBSD.ORG Thu Nov 15 18:53:19 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 7422478D for ; Thu, 15 Nov 2012 18:53:19 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id D44358FC18 for ; Thu, 15 Nov 2012 18:53:18 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id gg13so1948548lbb.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=VX1VvA5MNbnT3I7pAeGFGSojU8Z03+BcigYP/yaOCvD8nbJRXqh3ilk/HWS1RrhxS6 HbMqDzt3VRKplvzmY3PmhpZsW+L4+A6jkAZMWD1Xlhv82p8/SiU+7GGJ6gMJlSwLdFQ2 61Gd+RpSZrQDPRM39MpXHHt53NcbJpy1KV4ydJE6G7JuEpdSajhliM7idoNRk8k/hD4m iJg0Yjv6QIk2PN1uxKsxlCTkAWbhnUUfPr1vSsPamCI3idO+hQdkGyrq83Cr6xwMiG33 FX44emWlY8EIvbdOMT4G7YkF3Ond5cbIdw4rmkjIkEXNZdTB7FnEsMNhIM1+1wKFVGH9 kEOw== 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: ALoCoQnLYEgHExarMieolY/e6hjGvxJ1fXun7VwuqcbhWq75LXHJli9WtelTU+snzqYe205RFclh Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org 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 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