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>
This commit is contained in:
David Benjamin 2015-12-17 01:22:15 -05:00 committed by Adam Langley
parent 4cc671cbf4
commit c1cc858af2

View File

@ -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;