diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-10-21 22:05:50 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-10-21 22:05:50 +0800 |
commit | 23cc2bfb8cf82d378c4e678b9505ec328998aee7 (patch) | |
tree | 6bc7e7501480e71eaa9a2fe142225e5d02522fd7 /cli-runopts.c | |
parent | 9e379835c4ebbfef41440416fc72518e48ea8dde (diff) |
don't silently ignore extra flag arguments
Diffstat (limited to 'cli-runopts.c')
-rw-r--r-- | cli-runopts.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cli-runopts.c b/cli-runopts.c index 58b64ce..b251550 100644 --- a/cli-runopts.c +++ b/cli-runopts.c @@ -218,8 +218,12 @@ void cli_getopts(int argc, char ** argv) { if (argv[i][0] == '-') { /* A flag *waves* */ - - switch (argv[i][1]) { + char c = argv[i][1]; + if (strlen(argv[i]) != 2) { + /* Ensure only one flag per hyphen. '?' falls through to print help */ + c = '?'; + } + switch (c) { case 'y': /* always accept the remote hostkey */ if (cli_opts.always_accept_key) { /* twice means no checking at all */ |