summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/cbfstool/cbfstool.c8
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) {