From b599ce3b64b695cc7430f731a33e0f5bb83ae62c Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 23 Nov 2016 22:12:40 +0000 Subject: [PATCH] Fix missing NULL checks in CKE processing Reviewed-by: Rich Salz --- ssl/statem/statem_clnt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index ba873ee0a6..287d8ab8a6 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -2459,6 +2459,9 @@ static int tls_construct_cke_dhe(SSL *s, WPACKET *pkt, int *al) goto err; ckey = ssl_generate_pkey(skey); + if (ckey == NULL) + goto err; + dh_clnt = EVP_PKEY_get0_DH(ckey); if (dh_clnt == NULL || ssl_derive(s, ckey, skey, 0) == 0) @@ -2496,6 +2499,10 @@ static int tls_construct_cke_ecdhe(SSL *s, WPACKET *pkt, int *al) } ckey = ssl_generate_pkey(skey); + if (ckey == NULL) { + SSLerr(SSL_F_TLS_CONSTRUCT_CKE_ECDHE, ERR_R_MALLOC_FAILURE); + goto err; + } if (ssl_derive(s, ckey, skey, 0) == 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_ECDHE, ERR_R_EVP_LIB); -- 2.34.1