From a57bcd50c280fd2c48fd28de93dd94023ebdc980 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Tue, 15 Oct 2019 19:22:45 +0300 Subject: [PATCH] gost_ec_keyx: Fix CID 253282 Dereference null return value `param' is used unconditionally in pkey_GOST_ECcp_encrypt() so we can unconditionally check (vs in any particular `if' branch) for it's being non-NULL. This is similar to how pkey_GOST_ECcp_decrypt() works with `param'. Closes #174. --- gost_ec_keyx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c index fa068ae..963cd8a 100644 --- a/gost_ec_keyx.c +++ b/gost_ec_keyx.c @@ -263,6 +263,8 @@ static int pkey_GOST_ECcp_encrypt(EVP_PKEY_CTX *pctx, unsigned char *out, return 0; } } + if (!param) + goto err; /* Check for private key in the peer_key of context */ if (sec_key) { key_is_ephemeral = 0; -- 2.39.2