From owner-freebsd-hackers Mon Dec 2 4:38: 2 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 179A437B401; Mon, 2 Dec 2002 04:38:01 -0800 (PST) Received: from melusine.cuivre.fr.eu.org (melusine.cuivre.fr.eu.org [62.212.105.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7823743E4A; Mon, 2 Dec 2002 04:38:00 -0800 (PST) (envelope-from thomas@FreeBSD.ORG) Received: by melusine.cuivre.fr.eu.org (Postfix, from userid 1000) id DE5A22C3D1; Mon, 2 Dec 2002 13:37:52 +0100 (CET) Date: Mon, 2 Dec 2002 13:37:52 +0100 From: Thomas Quinot To: Peter Pentchev Cc: hackers@FreeBSD.org, audit@FreeBSD.org Subject: Re: [CFR] diskpart(1) buffer overflow fix Message-ID: <20021202123752.GA62114@melusine.cuivre.fr.eu.org> Reply-To: Thomas Quinot References: <20021202115809.GD372@straylight.oblivion.bg> <20021202122150.GE372@straylight.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20021202122150.GE372@straylight.oblivion.bg> User-Agent: Mutt/1.4i X-message-flag: WARNING! Using Outlook can damage your computer. Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Le 2002-12-02, Peter Pentchev écrivait : > > Attached are two patches: a trivial one which just fixes up two problems > > in diskpart's argument parsing, and a more complex one, which does it > > "the right way" IMHO, using getopt(3). The getopt-based version sounds better to me. > + case 'd': > + dflag++; > + if (pflag) > + usage(); > + break; > + > + case 'p': > + if (dflag) > + usage(); > + pflag++; > + break; I'd remove both tests and replace them with a single if (pflag && dflag) usage() after all arguments have been processed. Thomas. -- Thomas.Quinot@Cuivre.FR.EU.ORG To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message