summaryrefslogtreecommitdiffhomepage
path: root/cli-runopts.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli-runopts.c')
-rw-r--r--cli-runopts.c8
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 */