summaryrefslogtreecommitdiffstats
path: root/apps/rand.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-08-20 17:10:48 -0400
committerRich Salz <rsalz@openssl.org>2017-08-21 10:58:49 -0400
commitc27363f566274a65067d7559f9669f300f957183 (patch)
tree8f6f6166011fdf04e168c4582212554874a20e98 /apps/rand.c
parentb73b4d73de328de73c5a74ccc53291cd86a141e9 (diff)
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/rand.c')
-rw-r--r--apps/rand.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/rand.c b/apps/rand.c
index 34550065c0..cf45b43b2c 100644
--- a/apps/rand.c
+++ b/apps/rand.c
@@ -77,9 +77,13 @@ int rand_main(int argc, char **argv)
}
argc = opt_num_rest();
argv = opt_rest();
-
- if (argc != 1 || !opt_int(argv[0], &num) || num < 0)
+ 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;
+ }
out = bio_open_default(outfile, 'w', format);
if (out == NULL)