aboutsummaryrefslogtreecommitdiff
path: root/ssl/s3_enc.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-06-03 11:59:19 +0100
committerMatt Caswell <matt@openssl.org>2016-06-03 20:29:04 +0100
commit2c4a056f59a6819b8a0d40e3a7e11cf6d35b3e88 (patch)
treec9d9275b21fc98c0f18f44729c1b0cbaf93c1a50 /ssl/s3_enc.c
parentfa28bfd66fc221e18ee57134e42b54b4012e66db (diff)
downloadopenssl-2c4a056f59a6819b8a0d40e3a7e11cf6d35b3e88.zip
openssl-2c4a056f59a6819b8a0d40e3a7e11cf6d35b3e88.tar.gz
openssl-2c4a056f59a6819b8a0d40e3a7e11cf6d35b3e88.tar.bz2
Handle a memory allocation failure in ssl3_init_finished_mac()
The ssl3_init_finished_mac() function can fail, in which case we need to propagate the error up through the stack. RT#3198 Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r--ssl/s3_enc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c
index cb571c1..f7089bd 100644
--- a/ssl/s3_enc.c
+++ b/ssl/s3_enc.c
@@ -326,11 +326,18 @@ void ssl3_cleanup_key_block(SSL *s)
s->s3->tmp.key_block_length = 0;
}
-void ssl3_init_finished_mac(SSL *s)
+int ssl3_init_finished_mac(SSL *s)
{
+ BIO *buf = BIO_new(BIO_s_mem());
+
+ if (buf == NULL) {
+ SSLerr(SSL_F_SSL3_INIT_FINISHED_MAC, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
ssl3_free_digest_list(s);
- s->s3->handshake_buffer = BIO_new(BIO_s_mem());
+ s->s3->handshake_buffer = buf;
(void)BIO_set_close(s->s3->handshake_buffer, BIO_CLOSE);
+ return 1;
}
/*