Don't use an uninitialised variable in srp application
[openssl.git] / apps / pkcs7.c
index fff14dc95958ac9e62055d7f5a6b0c37ad6c3159..a2c1c6d04ef6e9e3562d5318e7770a557c6bb243 100644 (file)
@@ -191,10 +191,8 @@ int pkcs7_main(int argc, char **argv)
         }
     }
     argc = opt_num_rest();
-    argv = opt_rest();
-
-    if (!app_load_modules(NULL))
-        goto end;
+    if (argc != 0)
+        goto opthelp;
 
     in = bio_open_default(infile, 'r', informat);
     if (in == NULL)
@@ -224,12 +222,16 @@ int pkcs7_main(int argc, char **argv)
         i = OBJ_obj2nid(p7->type);
         switch (i) {
         case NID_pkcs7_signed:
-            certs = p7->d.sign->cert;
-            crls = p7->d.sign->crl;
+            if (p7->d.sign != NULL) {
+                certs = p7->d.sign->cert;
+                crls = p7->d.sign->crl;
+            }
             break;
         case NID_pkcs7_signedAndEnveloped:
-            certs = p7->d.signed_and_enveloped->cert;
-            crls = p7->d.signed_and_enveloped->crl;
+            if (p7->d.signed_and_enveloped != NULL) {
+                certs = p7->d.signed_and_enveloped->cert;
+                crls = p7->d.signed_and_enveloped->crl;
+            }
             break;
         default:
             break;