diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-04-30 23:09:39 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2004-04-30 23:09:39 +0000 |
commit | b898468f360201b90b00c2305f9d1280816f915e (patch) | |
tree | 4d3358b62c0c89ffbe5bded3e8c490cbc464a0ec /miscutils/strings.c | |
parent | 65d8eb92b45d6567db4950174636f2cafc008e65 (diff) | |
download | busybox-w32-b898468f360201b90b00c2305f9d1280816f915e.tar.gz busybox-w32-b898468f360201b90b00c2305f9d1280816f915e.tar.bz2 busybox-w32-b898468f360201b90b00c2305f9d1280816f915e.zip |
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.
git-svn-id: svn://busybox.net/trunk/busybox@8791 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'miscutils/strings.c')
-rw-r--r-- | miscutils/strings.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/miscutils/strings.c b/miscutils/strings.c index 5dcd876e9..92e9f0d11 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c | |||
@@ -67,7 +67,7 @@ int strings_main(int argc, char **argv) | |||
67 | i=0; | 67 | i=0; |
68 | 68 | ||
69 | string=xmalloc(n+1); | 69 | string=xmalloc(n+1); |
70 | /*string[n]='\0';*/ | 70 | string[n]='\0'; |
71 | n-=1; | 71 | n-=1; |
72 | 72 | ||
73 | if(argc==0) | 73 | if(argc==0) |
@@ -77,7 +77,7 @@ int strings_main(int argc, char **argv) | |||
77 | goto pipe; | 77 | goto pipe; |
78 | } | 78 | } |
79 | 79 | ||
80 | for( ;*argv!=NULL;*argv++) | 80 | for( ;*argv!=NULL && argc>0;argv++) |
81 | { | 81 | { |
82 | if((file=bb_wfopen(*argv,"r"))) | 82 | if((file=bb_wfopen(*argv,"r"))) |
83 | { | 83 | { |