From: Matt Caswell Date: Tue, 28 May 2019 10:28:16 +0000 (+0100) Subject: Fix NULL pointer dereference in the ex_data code X-Git-Tag: openssl-3.0.0-alpha1~1850 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f2d20f0bb8b79f37f785ca9eff5252188991dd8d;p=oweals%2Fopenssl.git Fix NULL pointer dereference in the ex_data code In some circumstances the global data held in the "global" variable can be NULL, so we should error out in the circumstance instead of crashing. Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/9035) --- diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 055420a95d..d7d0d5a726 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -36,7 +36,7 @@ static EX_CALLBACKS *get_and_lock(OPENSSL_CTX *ctx, int class_index) } global = openssl_ctx_get_ex_data_global(ctx); - if (global->ex_data_lock == NULL) { + if (global == NULL || global->ex_data_lock == NULL) { /* * This can happen in normal operation when using CRYPTO_mem_leaks(). * The CRYPTO_mem_leaks() function calls OPENSSL_cleanup() which cleans