coverity 1462572 Dereference after null check
authorPauli <paul.dale@oracle.com>
Sun, 26 Apr 2020 23:16:04 +0000 (09:16 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 30 Apr 2020 10:21:33 +0000 (20:21 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11651)

apps/lib/apps.c

index 1a23ae08461b83b1c95296eb1d380afa2bd95137..6facdf3e5b27b9057ab5e1098d1e999795004b98 100644 (file)
@@ -420,9 +420,13 @@ static int load_pkcs12(BIO *in, const char *desc,
     char tpass[PEM_BUFSIZE];
     int len, ret = 0;
     PKCS12 *p12;
+
     p12 = d2i_PKCS12_bio(in, NULL);
-    if (p12 == NULL && desc != NULL) {
-        BIO_printf(bio_err, "Error loading PKCS12 file for %s\n", desc);
+    if (p12 == NULL) {
+        if (desc != NULL)
+            BIO_printf(bio_err, "Error loading PKCS12 file for %s\n", desc);
+        else
+            BIO_printf(bio_err, "Error loading PKCS12 file\n");
         goto die;
     }
     /* See if an empty password will do */