Skip to content

Commit

Permalink
strings: broken -n NUM validation (#985)
Browse files Browse the repository at this point in the history
* The number passed to -n can be more than 1 digit

%/usr/bin/strings -n150 /bin/bash | md5sum && perl strings -n150 /bin/bash | md5sum
18cf22fcd75586ea1c6e5411c338c11d  -
18cf22fcd75586ea1c6e5411c338c11d  -
  • Loading branch information
mknos authored Mar 6, 2025
1 parent 82a1d85 commit 8fc4b57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/strings
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sub usage {

getopts( 'afon:t:' ) or usage();
if (defined $opt_n) {
if ($opt_n !~ m/\A[0-9]\Z/ || $opt_n == 0) {
if ($opt_n !~ m/\A[0-9]+\Z/ || $opt_n == 0) {
warn "$Program: invalid minimum string length '$opt_n'\n";
exit EX_FAILURE;
}
Expand Down

0 comments on commit 8fc4b57

Please sign in to comment.