# HG changeset patch # User Matt Johnston # Date 1445436350 -28800 # Node ID 67d8a904f5a949d2d5fac911027c5d19c0f798a7 # Parent 57d09741d46d5c654564a99671a6b712f0913b53 don't silently ignore extra flag arguments diff -r 57d09741d46d -r 67d8a904f5a9 cli-runopts.c --- a/cli-runopts.c Tue Sep 29 22:19:11 2015 +0800 +++ b/cli-runopts.c Wed Oct 21 22:05:50 2015 +0800 @@ -218,8 +218,12 @@ 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 */ diff -r 57d09741d46d -r 67d8a904f5a9 dbclient.1 --- a/dbclient.1 Tue Sep 29 22:19:11 2015 +0800 +++ b/dbclient.1 Wed Oct 21 22:05:50 2015 +0800 @@ -3,7 +3,7 @@ dbclient \- lightweight SSH client .SH SYNOPSIS .B dbclient -[\-Tt] [\-p +[flag arguments] [\-p .I port\fR] [\-i .I id\fR] [\-L .I l\fR:\fIh\fR:\fIr\fR] [\-R diff -r 57d09741d46d -r 67d8a904f5a9 dropbear.8 --- a/dropbear.8 Tue Sep 29 22:19:11 2015 +0800 +++ b/dropbear.8 Wed Oct 21 22:05:50 2015 +0800 @@ -3,7 +3,7 @@ dropbear \- lightweight SSH server .SH SYNOPSIS .B dropbear -[\-RFEmwsgjki] [\-b +[flag arguments] [\-b .I banner\fR] [\-r .I hostkeyfile\fR] [\-p diff -r 57d09741d46d -r 67d8a904f5a9 svr-runopts.c --- a/svr-runopts.c Tue Sep 29 22:19:11 2015 +0800 +++ b/svr-runopts.c Wed Oct 21 22:05:50 2015 +0800 @@ -189,7 +189,12 @@ } if (argv[i][0] == '-') { - 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 'b': next = &svr_opts.bannerfile; break;