[BusyBox-cvs] busybox/miscutils strings.c,1.13,1.14

Glenn McGrath bug1 at busybox.net
Fri Apr 30 23:09:42 UTC 2004


Update of /var/cvs/busybox/miscutils
In directory nail:/tmp/cvs-serv14742/miscutils

Modified Files:
	strings.c 
Log Message:
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.


Index: strings.c
===================================================================
RCS file: /var/cvs/busybox/miscutils/strings.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- a/strings.c	15 Mar 2004 08:28:46 -0000	1.13
+++ b/strings.c	30 Apr 2004 23:09:39 -0000	1.14
@@ -67,7 +67,7 @@
 	i=0;
 
 	string=xmalloc(n+1);
-	/*string[n]='\0';*/
+	string[n]='\0';
 	n-=1;
 
 	if(argc==0)
@@ -77,7 +77,7 @@
 		goto pipe;
 	}
 
-	for(  ;*argv!=NULL;*argv++)
+	for( ;*argv!=NULL && argc>0;argv++)
 	{
 		if((file=bb_wfopen(*argv,"r")))
 		{




More information about the busybox-cvs mailing list