[BusyBox] [PATCH RESEND] bug in strings.c
Tito
farmatito at tiscali.it
Fri Apr 23 14:02:11 UTC 2004
Hi to all
would you please apply the following patch for strings.c
as it fixes some bugs that should not go in 1.00.
The bugs are
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) fix a 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 me.
Ciao,
Tito
-------------- next part --------------
--- miscutils/strings_orig.c 2004-03-15 08:28:46.000000000 +0000
+++ miscutils/strings.c 2004-04-18 03:27:34.564837568 +0000
@@ -67,9 +67,8 @@
i=0;
string=xmalloc(n+1);
- /*string[n]='\0';*/
+ string[n]='\0';
n-=1;
-
if(argc==0)
{
fmt="{%s}: ";
@@ -77,7 +76,7 @@
goto pipe;
}
- for( ;*argv!=NULL;*argv++)
+ for( ;*argv!=NULL && argc>0;argv++)
{
if((file=bb_wfopen(*argv,"r")))
{
More information about the busybox
mailing list