From owner-freebsd-bugs Tue Oct 8 4:51:40 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 121C937B406 for ; Tue, 8 Oct 2002 04:51:38 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD3C343E4A for ; Tue, 8 Oct 2002 04:51:37 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g98BpbCo052696 for ; Tue, 8 Oct 2002 04:51:37 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g98BpbNK052695; Tue, 8 Oct 2002 04:51:37 -0700 (PDT) Date: Tue, 8 Oct 2002 04:51:37 -0700 (PDT) Message-Id: <200210081151.g98BpbNK052695@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Giorgos Keramidas Subject: Re: bin/43810: 'echo' is too big Reply-To: Giorgos Keramidas Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/43810; it has been noted by GNATS. From: Giorgos Keramidas To: Tim Kientzle Cc: bug-followup@freebsd.org Subject: Re: bin/43810: 'echo' is too big Date: Tue, 8 Oct 2002 12:47:51 +0300 On 2002-10-07 20:52, Tim Kientzle wrote: > > diff --context echo.c-original echo.c > *** echo.c-original Mon Oct 7 20:44:50 2002 > --- echo.c Mon Oct 7 20:44:15 2002 > *************** > *** 45,52 **** > #include > __FBSDID("$FreeBSD: src/bin/echo/echo.c,v 1.13 2002/06/30 05:13:53 obrien Exp > $"); > > - #include > - #include > #include > > /* ARGSUSED */ > --- 45,50 ---- > *************** > *** 56,62 **** > int nflag; /* if not set, output a trailing newline. */ > > /* This utility may NOT do getopt(3) option parsing. */ > ! if (*++argv && !strcmp(*argv, "-n")) { > ++argv; > nflag = 1; > } > --- 54,60 ---- > int nflag; /* if not set, output a trailing newline. */ > > /* This utility may NOT do getopt(3) option parsing. */ > ! if (*++argv && argv[0][0]=='-' && argv[0][1]=='n') { > ++argv; > nflag = 1; > } You're not checking for argv[0][2] == '\0'. This will make strange command lines like work in unexpected ways. $ echo -nocheck "foo" Giorgos. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message