From: Bernd Edlinger Date: Tue, 13 Jun 2017 16:08:40 +0000 (+0200) Subject: Fix crash in ecdh_simple_compute_key. X-Git-Tag: OpenSSL_1_1_1-pre1~1318 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abea494cf75061650deecf584adc2cd293ce322d;p=openssl Fix crash in ecdh_simple_compute_key. Reviewed-by: Matt Caswell Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3671) --- diff --git a/crypto/ec/ecdh_ossl.c b/crypto/ec/ecdh_ossl.c index caf65de8c4..a865145974 100644 --- a/crypto/ec/ecdh_ossl.c +++ b/crypto/ec/ecdh_ossl.c @@ -66,6 +66,10 @@ int ecdh_simple_compute_key(unsigned char **pout, size_t *poutlen, BN_CTX_start(ctx); x = BN_CTX_get(ctx); y = BN_CTX_get(ctx); + if (y == NULL) { + ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); + goto err; + } priv_key = EC_KEY_get0_private_key(ecdh); if (priv_key == NULL) {