]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
gost_ec_keyx: Fix CID 253282 Dereference null return value
authorVitaly Chikunov <vt@altlinux.org>
Tue, 15 Oct 2019 16:22:45 +0000 (19:22 +0300)
committerVitaly Chikunov <vt@altlinux.org>
Tue, 15 Oct 2019 16:36:15 +0000 (19:36 +0300)
`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

index fa068aec45c0fcacaf37bc8415d4d954481bc3f1..963cd8ac852b35ff701f6ceff45a31824a986e1f 100644 (file)
@@ -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;