Skip to content
Snippets Groups Projects
Commit 23cc2bfb authored by Matt Johnston's avatar Matt Johnston
Browse files

don't silently ignore extra flag arguments

parent 9e379835
No related merge requests found
...@@ -218,8 +218,12 @@ void cli_getopts(int argc, char ** argv) { ...@@ -218,8 +218,12 @@ void cli_getopts(int argc, char ** argv) {
if (argv[i][0] == '-') { if (argv[i][0] == '-') {
/* A flag *waves* */ /* A flag *waves* */
char c = argv[i][1];
switch (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 */ case 'y': /* always accept the remote hostkey */
if (cli_opts.always_accept_key) { if (cli_opts.always_accept_key) {
/* twice means no checking at all */ /* twice means no checking at all */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
dbclient \- lightweight SSH client dbclient \- lightweight SSH client
.SH SYNOPSIS .SH SYNOPSIS
.B dbclient .B dbclient
[\-Tt] [\-p [flag arguments] [\-p
.I port\fR] [\-i .I port\fR] [\-i
.I id\fR] [\-L .I id\fR] [\-L
.I l\fR:\fIh\fR:\fIr\fR] [\-R .I l\fR:\fIh\fR:\fIr\fR] [\-R
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
dropbear \- lightweight SSH server dropbear \- lightweight SSH server
.SH SYNOPSIS .SH SYNOPSIS
.B dropbear .B dropbear
[\-RFEmwsgjki] [\-b [flag arguments] [\-b
.I banner\fR] .I banner\fR]
[\-r [\-r
.I hostkeyfile\fR] [\-p .I hostkeyfile\fR] [\-p
......
...@@ -189,7 +189,12 @@ void svr_getopts(int argc, char ** argv) { ...@@ -189,7 +189,12 @@ void svr_getopts(int argc, char ** argv) {
} }
if (argv[i][0] == '-') { 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': case 'b':
next = &svr_opts.bannerfile; next = &svr_opts.bannerfile;
break; break;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment