Red Hat Bugzilla – Bug 435078
The output of "strings -0 file" is in loop and "-n 0xA" cannot be correctly recognized
Last modified: 2010-10-22 18:49:26 EDT
Description of problem:
Use "strings -0 file", the output will be in loop.
And "strings -n 0xA file" will report error as "invalid number 0xA"
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.touch file contains some characters
2.execute "strings -0 file"
3.execute "strings -n 0xA file"
step2 is in loop and step3 will report "invalid number 0xA"
step2 will report "invalid number 0" and step3 will print the strings of which
the length is more than 9 in file.
It seems the minumum length of "strings -n 0xB" is not 11.
Created attachment 296030 [details]
correct the bug when using "-0" and use strtoul() in replace integer_arg() to fix "-n hexnumber"
Created attachment 302600 [details]
Upstream form of the Comment 1 patch.
2008-02-15 Chu Li <email@example.com>
Nick Clifton <firstname.lastname@example.org>
* strings.c (integer_arg): Delete function.
(string_min): Initialise to 4.
(main): Use strtoul to parse integer arguments.
Move check for an invalid string length to after all the arguments
have been parsed.
(usage): Use indentation to indicate that -<n> is a another form
of the --bytes= command line option.
2008-02-08 H.J. Lu <email@example.com>
* strings.c (main): Set string_min to 4 if it is <= 0.
Created attachment 302601 [details]
Upstream patch reduced for a needless output change for RHEL.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.