diff options
author | Rich Salz <rsalz@openssl.org> | 2017-08-20 23:10:48 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-08-21 16:58:49 +0200 |
commit | c27363f566274a65067d7559f9669f300f957183 (patch) | |
tree | 8f6f6166011fdf04e168c4582212554874a20e98 /apps/genrsa.c | |
parent | Add PKEY_CTX setter tests for TLS1-PRF (diff) | |
download | openssl-c27363f566274a65067d7559f9669f300f957183.tar.xz openssl-c27363f566274a65067d7559f9669f300f957183.zip |
Check # of arguments for remaining commands.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/4201)
Diffstat (limited to 'apps/genrsa.c')
-rw-r--r-- | apps/genrsa.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/genrsa.c b/apps/genrsa.c index 2bc70a9063..ebd69e15ed 100644 --- a/apps/genrsa.c +++ b/apps/genrsa.c @@ -78,6 +78,7 @@ int genrsa_main(int argc, char **argv) switch (o) { case OPT_EOF: case OPT_ERR: +opthelp: BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); goto end; case OPT_HELP: @@ -111,11 +112,16 @@ int genrsa_main(int argc, char **argv) } argc = opt_num_rest(); argv = opt_rest(); - private = 1; - if (argv[0] && (!opt_int(argv[0], &num) || num <= 0)) - goto end; + if (argc == 1) { + if (!opt_int(argv[0], &num) || num <= 0) + goto end; + } else if (argc > 0) { + BIO_printf(bio_err, "Extra arguments given.\n"); + goto opthelp; + } + private = 1; if (!app_passwd(NULL, passoutarg, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); goto end; |