Date: Tue, 8 Oct 2002 04:51:37 -0700 (PDT) From: Giorgos Keramidas <keramida@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/43810: 'echo' is too big Message-ID: <200210081151.g98BpbNK052695@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/43810; it has been noted by GNATS. From: Giorgos Keramidas <keramida@freebsd.org> To: Tim Kientzle <kientzle@acm.org> 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 <kientzle@acm.org> 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 <sys/cdefs.h> > __FBSDID("$FreeBSD: src/bin/echo/echo.c,v 1.13 2002/06/30 05:13:53 obrien Exp > $"); > > - #include <stdio.h> > - #include <stdlib.h> > #include <string.h> > > /* 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210081151.g98BpbNK052695>