From a98810bfac37a77750592611bb9f5a22e4634692 Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Sat, 13 Feb 2016 19:01:14 +0100 Subject: [PATCH] Fix some malloc failure crashes on X509_STORE_CTX_set_ex_data from BoringSSL 306ece31bcaaed49e0240a2e5555f8901ebb2d45 Reviewed-by: Rich Salz Reviewed-by: Matt Caswell --- ssl/ssl_cert.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index f285fbe882..7481705ed0 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -409,7 +409,9 @@ int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk) /* Set suite B flags if needed */ X509_STORE_CTX_set_flags(ctx, tls1_suiteb(s)); - X509_STORE_CTX_set_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s); + if (!X509_STORE_CTX_set_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s)) { + goto end; + } /* Verify via DANE if enabled */ if (DANETLS_ENABLED(&s->dane)) -- 2.25.1