From c1cc858af265dd57446c14cbbd22f35aaed4d821 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 17 Dec 2015 01:22:15 -0500 Subject: [PATCH] Check for EC_KEY_set_public_key error. This function may fail on malloc error. Change-Id: I8631b1763dac5a3801fcaca81bdfcb8d24d3728c Reviewed-on: https://boringssl-review.googlesource.com/6765 Reviewed-by: Adam Langley --- ssl/s3_clnt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c index f9d76935..b4e41336 100644 --- a/ssl/s3_clnt.c +++ b/ssl/s3_clnt.c @@ -1230,7 +1230,9 @@ int ssl3_get_server_key_exchange(SSL *s) { OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_ECPOINT); goto f_err; } - EC_KEY_set_public_key(ecdh, srvr_ecpoint); + if (!EC_KEY_set_public_key(ecdh, srvr_ecpoint)) { + goto err; + } EC_KEY_free(s->s3->tmp.peer_ecdh_tmp); s->s3->tmp.peer_ecdh_tmp = ecdh; ecdh = NULL;