From 64da55a64f141bb068f034ab0df34ec2a044e482 Mon Sep 17 00:00:00 2001 From: Pauli Date: Sun, 8 Sep 2019 18:37:13 +1000 Subject: [PATCH] Coverity 1453632 & 1453635: Null pointer dereferences (FORWARD_NULL) Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/9805) --- test/evp_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/evp_test.c b/test/evp_test.c index 1ff90c2283..67a818d98d 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -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); -- 2.25.1