Fix srp app missing NULL termination with password callback
[oweals/openssl.git] / apps / req.c
index a1cbfe2d2b1756183879d57669014cfa1e2b930a..a749925ba045d7f610ff0532cb1a434db7934540 100644 (file)
@@ -289,7 +289,6 @@ int req_main(int argc, char **argv)
             break;
         case OPT_X509:
             x509 = 1;
-            newreq = 1;
             break;
         case OPT_DAYS:
             days = atoi(opt_arg());
@@ -329,6 +328,9 @@ int req_main(int argc, char **argv)
     if (argc != 0)
         goto opthelp;
 
+    if (x509 && infile == NULL)
+        newreq = 1;
+
     if (!nmflag_set)
         nmflag = XN_FLAG_ONELINE;
 
@@ -583,7 +585,7 @@ int req_main(int argc, char **argv)
         }
     }
 
-    if (newreq) {
+    if (newreq || x509) {
         if (pkey == NULL) {
             BIO_printf(bio_err, "you need to specify a private key\n");
             goto end;