Re: [PATCH] strings: use '-0' as option will meet infinite loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



chuli wrote:
> 	When I use the command "strings" like this: "strings -0 file" will trap in infinite loop. 
> 	The binutils version is 2.17.50.0.6. Has this bug been fixed?
> 	If not, here is my patch.
> 	Thank you.
> 

So I guess you sent this patch to the wrong place, you should send
it to bug-binutils@xxxxxxx i mean.

> Chu Li
> 
> Signed-off-by: Chu Li <chul@xxxxxxxxxxxxxxxxx>

BTW:

s/chul@xxxxxxxxxxxxxxxxx/chul@xxxxxxxxxxxxxx ;)

> ----------------------------------------------
> diff --git a/strings.c b/strings.c
> index 4c68ea8..8ee2783 100644
> --- a/strings.c
> +++ b/strings.c
> @@ -274,6 +274,9 @@ main (int argc, char **argv)
>         }
>      }
> 
> +  if(string_min == 0)
> +    fatal (_("invalid number %d"), string_min);
> +
>    if (string_min < 0)
>      string_min = 4;
> 
> -

And maybe this will be better:

-  if (string_min < 0)
+  if (string_min <= 0)

or this ?

+  if(string_min <= 0)
+    fatal (_("invalid number %d"), string_min);
+
-  if (string_min < 0)
-    string_min = 4;
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux