diff options
author | Nico Huber <nico.h@gmx.de> | 2016-08-01 23:18:29 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2016-08-03 10:12:02 +0200 |
commit | 5407310e64ea34b41ca4226ad724642f2b5de8fa (patch) | |
tree | 03fc17bd8b693ec4d7f01fd0ce532976b135debd | |
parent | 9ade7175712a6ebab3a1abd188208b07a2a3fd76 (diff) |
cbfstool: Check for excessive arguments
Change-Id: I66de6a33b43c284198c0a0a97c5c6a10f9b96e02
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/16019
Tested-by: build bot (Jenkins)
Reviewed-by: Omar Pakker
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r-- | util/cbfstool/cbfstool.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index e1bdf2f71a..e70cb4b0b8 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -1296,8 +1296,14 @@ int main(int argc, char **argv) c = getopt_long(argc, argv, commands[i].optstring, long_options, &option_index); - if (c == -1) + if (c == -1) { + if (optind < argc) { + ERROR("%s: excessive argument -- '%s'" + "\n", argv[0], argv[optind]); + return 1; + } break; + } /* filter out illegal long options */ if (strchr(commands[i].optstring, c) == NULL) { |