summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-17 13:04:20 +1000
committerPauli <ppzgs1@gmail.com>2021-03-20 10:18:32 +1000
commit337ace06b9f112c5a5f540840814348ba17984d0 (patch)
tree0abf415f5b3e1ee298bf92c85e9801f573a5b360 /test
parentb6f0f546ff06fa9aa7e37c1a272e3a712c81fdc0 (diff)
test: coverity 1455747 - dereference after null check
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14589)
Diffstat (limited to 'test')
-rw-r--r--test/evp_test.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index bd32ad5c7b..0c81939f2e 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -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)