diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2008-11-26 14:24:35 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2008-11-26 14:24:35 +0000 |
commit | 508e676df1a21a34a1b53b004bed87a3358d776b (patch) | |
tree | 227c59cd35738bd3e8a2c8ac34c34818a75be8e1 /binutils/strings.c | |
parent | a85c0b494e07723a497e00242518c762b4169c5d (diff) | |
download | gdb-508e676df1a21a34a1b53b004bed87a3358d776b.zip gdb-508e676df1a21a34a1b53b004bed87a3358d776b.tar.gz gdb-508e676df1a21a34a1b53b004bed87a3358d776b.tar.bz2 |
* strings.c (main): New variable `s'. Have string_min parsing
call fatal for invalid input strings.
Diffstat (limited to 'binutils/strings.c')
-rw-r--r-- | binutils/strings.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/binutils/strings.c b/binutils/strings.c index 8a0f011..30d2749 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; } } |