diff options
Diffstat (limited to 'contrib/elftoolchain/strings')
-rw-r--r-- | contrib/elftoolchain/strings/os.NetBSD.mk | 2 | ||||
-rw-r--r-- | contrib/elftoolchain/strings/strings.1 | 7 | ||||
-rw-r--r-- | contrib/elftoolchain/strings/strings.c | 12 |
3 files changed, 15 insertions, 6 deletions
diff --git a/contrib/elftoolchain/strings/os.NetBSD.mk b/contrib/elftoolchain/strings/os.NetBSD.mk new file mode 100644 index 000000000000..ae214e3115c0 --- /dev/null +++ b/contrib/elftoolchain/strings/os.NetBSD.mk @@ -0,0 +1,2 @@ +# TODO(#511): Revert after the source tree is -Wconversion clean. +WARNS=5 diff --git a/contrib/elftoolchain/strings/strings.1 b/contrib/elftoolchain/strings/strings.1 index 15ad7a7f1eb3..205afdfc4505 100644 --- a/contrib/elftoolchain/strings/strings.1 +++ b/contrib/elftoolchain/strings/strings.1 @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: strings.1 3195 2015-05-12 17:22:19Z emaste $ +.\" $Id: strings.1 3360 2016-01-24 18:34:06Z jkoshy $ .\" -.Dd December 19, 2011 +.Dd January 24, 2016 .Dt STRINGS 1 .Os .Sh NAME @@ -100,6 +100,9 @@ Print a usage summary and exit. Print the contiguous character sequence of at least .Ar number characters long, instead of the default of 4 characters. +Argument +.Ar number +should specify a positive decimal integer. .It Fl o Equivalent to specifying .Fl t Ar o . diff --git a/contrib/elftoolchain/strings/strings.c b/contrib/elftoolchain/strings/strings.c index 6eab165e0bf4..f122eba34393 100644 --- a/contrib/elftoolchain/strings/strings.c +++ b/contrib/elftoolchain/strings/strings.c @@ -37,6 +37,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sysexits.h> #include <unistd.h> #include <libelf.h> @@ -45,7 +46,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: strings.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: strings.c 3360 2016-01-24 18:34:06Z jkoshy $"); enum return_code { RETURN_OK, @@ -73,10 +74,10 @@ enum encoding_style { ((c) == '\t' || isprint((c)) || \ (encoding == ENCODING_8BIT && (c) > 127))) - -static int encoding_size, entire_file, min_len, show_filename, show_loc; +static int encoding_size, entire_file, show_filename, show_loc; static enum encoding_style encoding; static enum radix_style radix; +static intmax_t min_len; static struct option strings_longopts[] = { { "all", no_argument, NULL, 'a'}, @@ -144,7 +145,10 @@ main(int argc, char **argv) show_filename = 1; break; case 'n': - min_len = (int)strtoimax(optarg, (char**)NULL, 10); + min_len = strtoimax(optarg, (char**)NULL, 10); + if (min_len <= 0) + errx(EX_USAGE, "option -n should specify a " + "positive decimal integer."); break; case 'o': show_loc = 1; |