RT4669: dgst can only sign/verify one file
authorRichard Levitte <levitte@openssl.org>
Tue, 20 Sep 2016 19:41:58 +0000 (21:41 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 20 Sep 2016 19:56:04 +0000 (21:56 +0200)
Check arg count and print an error message.

Reviewed-by: Rich Salz <rsalz@openssl.org>
apps/dgst.c

index 95e5fa3fc7b7d5cb9f4230f5c9dd3cb71492dba3..26afcd7b30baf1643e85edef0e3e045d346d5f9c 100644 (file)
@@ -243,6 +243,11 @@ int MAIN(int argc, char **argv)
         argv++;
     }
 
+    if (keyfile != NULL && argc > 1) {
+        BIO_printf(bio_err, "Can only sign or verify one file\n");
+        goto end;
+    }
+
     if (do_verify && !sigfile) {
         BIO_printf(bio_err,
                    "No signature to verify: use the -signature option\n");