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 <agl@google.com>
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index f9d7693..b4e4133 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -1230,7 +1230,9 @@
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;