[BusyBox] more patches: break strings applet[PATCH RESEND]

Tito farmatito at tiscali.it
Sun Apr 18 03:37:09 UTC 2004


On Saturday 17 April 2004 23:38, Larry Doolittle wrote:
> Here is the patch set that has resulted from my recent hacking
> on busybox-1.00-pre10.  Please study, test, and consider including
> them in -pre11.
>     - Larry
> 
> diff -urN foo/miscutils/strings.c busybox-1.00-pre10-hacked/miscutils/strings.c
> --- foo/miscutils/strings.c	2004-03-15 00:28:46.000000000 -0800
> +++ busybox-1.00-pre10-hacked/miscutils/strings.c	2004-04-14 20:50:27.000000000 -0700
> @@ -77,7 +77,7 @@
>  		goto pipe;
>  	}
>  
> -	for(  ;*argv!=NULL;*argv++)
> +	for(  ;*argv!=NULL;argv++)
>  	{
>  		if((file=bb_wfopen(*argv,"r")))
>  		{
Hi,
please don't apply the strings patch as this breaks:
root at localhost:/dev/pts/1:/rep/busybox-1.00-pre10# cat README | ./strings
as you get the correct strings output plus:
       <andersen at codepoet.org>
strings: LESSKEY=/etc/.less: No such file or directory
strings: LC_PAPER=en_US: No such file or directory
strings: KDE_MULTIHEAD=false: No such file or directory
strings: LC_ADDRESS=en_US: No such file or directory
strings: LC_MONETARY=en_US: No such file or directory
strings: HOSTNAME=localhost: No such file or directory

snip

a lot of noise.

Please consider the following amended attached patch that is the result of a long 
thread of the last days.
This patch includes the fixes by Ian Latter and Larry Doolittle.

--- 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")))
                {
--END--

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