]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Coverity 1453632 & 1453635: Null pointer dereferences (FORWARD_NULL)
authorPauli <paul.dale@oracle.com>
Sun, 8 Sep 2019 08:37:13 +0000 (18:37 +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)

test/evp_test.c

index 1ff90c2283a056aea5d1485cbe548a4c9b42b57e..67a818d98d6d6230a7c0a4fc88f605d5c119ea18 100644 (file)
@@ -2047,14 +2047,15 @@ static int kdf_test_ctrl(EVP_TEST *t, EVP_KDF_CTX *kctx,
     if (p != NULL)
         *p++ = '\0';
 
-    rv = OSSL_PARAM_allocate_from_text(kdata->p, defs, name, p, strlen(p));
+    rv = OSSL_PARAM_allocate_from_text(kdata->p, defs, name, p,
+                                       p != NULL ? strlen(p) : 0);
     *++kdata->p = OSSL_PARAM_construct_end();
     if (!rv) {
         t->err = "KDF_PARAM_ERROR";
         OPENSSL_free(name);
         return 0;
     }
-    if (strcmp(name, "digest") == 0 && p != NULL) {
+    if (p != NULL && strcmp(name, "digest") == 0) {
         /* If p has an OID and lookup fails assume disabled algorithm */
         int nid = OBJ_sn2nid(p);