summaryrefslogtreecommitdiffstats
path: root/crypto/ex_data.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-05-28 11:28:16 +0100
committerMatt Caswell <matt@openssl.org>2019-06-28 10:22:21 +0100
commitf2d20f0bb8b79f37f785ca9eff5252188991dd8d (patch)
treefc118724752746783631a0bcea13f55dc8582b05 /crypto/ex_data.c
parent57ca171a131e6d55b4c4f6decefedeaa509db702 (diff)
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 <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/9035)
Diffstat (limited to 'crypto/ex_data.c')
-rw-r--r--crypto/ex_data.c2
1 files changed, 1 insertions, 1 deletions
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