Coverity 1453627: Null pointer dereferences (REVERSE_INULL)
authorPauli <paul.dale@oracle.com>
Sun, 8 Sep 2019 08:28:56 +0000 (18:28 +1000)
committerPauli <paul.dale@oracle.com>
Tue, 10 Sep 2019 22:27:26 +0000 (08:27 +1000)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9805)

ssl/t1_enc.c

index 4419d3f..6726d8f 100644 (file)
@@ -35,7 +35,7 @@ static int tls1_PRF(SSL *s,
     EVP_KDF *kdf;
     EVP_KDF_CTX *kctx = NULL;
     OSSL_PARAM params[8], *p = params;
     EVP_KDF *kdf;
     EVP_KDF_CTX *kctx = NULL;
     OSSL_PARAM params[8], *p = params;
-    const char *mdname = EVP_MD_name(md);
+    const char *mdname;
 
     if (md == NULL) {
         /* Should never happen */
 
     if (md == NULL) {
         /* Should never happen */
@@ -53,6 +53,7 @@ static int tls1_PRF(SSL *s,
     EVP_KDF_free(kdf);
     if (kctx == NULL)
         goto err;
     EVP_KDF_free(kdf);
     if (kctx == NULL)
         goto err;
+    mdname = EVP_MD_name(md);
     *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
                                             (char *)mdname, strlen(mdname) + 1);
     *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
     *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
                                             (char *)mdname, strlen(mdname) + 1);
     *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,