]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: coverity 1455747 - dereference after null check
authorPauli <ppzgs1@gmail.com>
Wed, 17 Mar 2021 03:04:20 +0000 (13:04 +1000)
committerPauli <ppzgs1@gmail.com>
Sat, 20 Mar 2021 00:18:32 +0000 (10:18 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14589)

test/evp_test.c

index bd32ad5c7b7b3bfa1a8dd600c8d120ad978bad0d..0c81939f2e4424c9c00bd5bb94dd8034676d6f20 100644 (file)
@@ -1115,15 +1115,16 @@ static int mac_test_parse(EVP_TEST *t,
 static int mac_test_ctrl_pkey(EVP_TEST *t, EVP_PKEY_CTX *pctx,
                               const char *value)
 {
-    int rv;
+    int rv = 0;
     char *p, *tmpval;
 
     if (!TEST_ptr(tmpval = OPENSSL_strdup(value)))
         return 0;
     p = strchr(tmpval, ':');
-    if (p != NULL)
+    if (p != NULL) {
         *p++ = '\0';
-    rv = EVP_PKEY_CTX_ctrl_str(pctx, tmpval, p);
+        rv = EVP_PKEY_CTX_ctrl_str(pctx, tmpval, p);
+    }
     if (rv == -2)
         t->err = "PKEY_CTRL_INVALID";
     else if (rv <= 0)