Fix missing NULL check in prov_config_test openssl-3.1
authorNeil Horman <nhorman@openssl.org>
Fri, 19 Apr 2024 14:17:54 +0000 (10:17 -0400)
committerTomas Mraz <tomas@openssl.org>
Fri, 26 Apr 2024 12:04:25 +0000 (14:04 +0200)
coverity-1596500 caught a missing null check.  We should never hit it as
the test harness always sets the environment variable, but lets add the
check for safety

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24198)

test/prov_config_test.c

index fee2dffdb206ec2119c0384f2c48b33f2be894fd..4f0cbc247b4311877f91fac0c7f0c0be51dec262 100644 (file)
@@ -83,6 +83,9 @@ static int test_path_config(void)
     char *full_path = NULL;
     int rc;
 
+    if (!TEST_ptr(module_path))
+        return 0;
+
     full_path = OPENSSL_zalloc(strlen(module_path) + strlen(P_TEST_PATH) + 1);
     if (!TEST_ptr(full_path))
         return 0;