summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorGlenn L McGrath2004-04-30 23:09:39 +0000
committerGlenn L McGrath2004-04-30 23:09:39 +0000
commitedaf39156a87522492aa62f600c500a3338f433d (patch)
tree4d3358b62c0c89ffbe5bded3e8c490cbc464a0ec /miscutils
parentfaa3546fd74bcb6cf193bebe8662a718e13d8fdf (diff)
downloadbusybox-edaf39156a87522492aa62f600c500a3338f433d.zip
busybox-edaf39156a87522492aa62f600c500a3338f433d.tar.gz
Bugfixes
1) a non NULL terminated buffer that can mess up output, spotted by Ian Latter 2) in miscutils/strings.c: get rid of useless pointer dereference in third part of for(;;), spotted by Larry Doolittle 3) bug when reading from a pipe and being invoked as strings "cat Readme | strings" is broken "cat Readme | busybox strings" works spotted by Ian Latter and fixed by Tito.
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/strings.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 5dcd876..92e9f0d 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -67,7 +67,7 @@ int strings_main(int argc, char **argv)
i=0;
string=xmalloc(n+1);
- /*string[n]='\0';*/
+ string[n]='\0';
n-=1;
if(argc==0)
@@ -77,7 +77,7 @@ int strings_main(int argc, char **argv)
goto pipe;
}
- for( ;*argv!=NULL;*argv++)
+ for( ;*argv!=NULL && argc>0;argv++)
{
if((file=bb_wfopen(*argv,"r")))
{