Skip to content

Commit efbe126

Browse files
committed
Fix missing NULL checks in CKE processing
Reviewed-by: Rich Salz <rsalz@openssl.org>
1 parent 793d9b7 commit efbe126

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: ssl/statem/statem_clnt.c

+9
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,11 @@ static int tls_construct_cke_dhe(SSL *s, unsigned char **p, int *len, int *al)
22582258
return 0;
22592259
}
22602260
ckey = ssl_generate_pkey(skey);
2261+
if (ckey == NULL) {
2262+
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_DHE, ERR_R_INTERNAL_ERROR);
2263+
return 0;
2264+
}
2265+
22612266
dh_clnt = EVP_PKEY_get0_DH(ckey);
22622267

22632268
if (dh_clnt == NULL || ssl_derive(s, ckey, skey) == 0) {
@@ -2296,6 +2301,10 @@ static int tls_construct_cke_ecdhe(SSL *s, unsigned char **p, int *len, int *al)
22962301
}
22972302

22982303
ckey = ssl_generate_pkey(skey);
2304+
if (ckey == NULL) {
2305+
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_ECDHE, ERR_R_INTERNAL_ERROR);
2306+
goto err;
2307+
}
22992308

23002309
if (ssl_derive(s, ckey, skey) == 0) {
23012310
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_ECDHE, ERR_R_EVP_LIB);

0 commit comments

Comments
 (0)