From: Jan Kratochvil Date: Wed, 26 Nov 2008 14:24:35 +0000 (+0000) Subject: * strings.c (main): New variable `s'. Have string_min parsing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=508e676df1a21a34a1b53b004bed87a3358d776b;p=binutils-gdb.git * strings.c (main): New variable `s'. Have string_min parsing call fatal for invalid input strings. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index c817fc9a9df..7d0c9a46392 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2008-11-26 Jan Kratochvil + + * strings.c (main): New variable `s'. Have string_min parsing + call fatal for invalid input strings. + 2008-11-25 Nick Clifton PR7044 diff --git a/binutils/strings.c b/binutils/strings.c index 8a0f01192c1..30d27490379 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -155,6 +155,7 @@ main (int argc, char **argv) int optc; int exit_status = 0; bfd_boolean files_given = FALSE; + char *s; #if defined (HAVE_SETLOCALE) setlocale (LC_ALL, ""); @@ -192,7 +193,9 @@ main (int argc, char **argv) usage (stdout, 0); case 'n': - string_min = (int) strtoul (optarg, NULL, 0); + string_min = (int) strtoul (optarg, &s, 0); + if (s != NULL && *s != 0) + fatal (_("invalid integer argument %s"), optarg); break; case 'o': @@ -242,7 +245,9 @@ main (int argc, char **argv) usage (stderr, 1); default: - string_min = (int) strtoul (argv[optind - 1] + 1, NULL, 0); + string_min = (int) strtoul (argv[optind - 1] + 1, &s, 0); + if (s != NULL && *s != 0) + fatal (_("invalid integer argument %s"), argv[optind - 1] + 1); break; } }