test: coverity 1455749 - dereference after null check

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14589)
This commit is contained in:
Pauli 2021-03-17 13:05:37 +10:00
parent 337ace06b9
commit 8f586f5bc1

View File

@ -1460,15 +1460,16 @@ static void pkey_test_cleanup(EVP_TEST *t)
static int pkey_test_ctrl(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);
}
if (rv == -2) {
t->err = "PKEY_CTRL_INVALID";
rv = 1;