summaryrefslogtreecommitdiffstats
path: root/crypto/provider_conf.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-11-10 21:49:49 +0100
committerPauli <pauli@openssl.org>2021-11-12 10:53:02 +0100
commited5b26ce0b34ec00bdd53d15854a22bccbb4d415 (patch)
treebc5aef4074b3c2ed8dc2ca8cb4d428eaaaf2f41c /crypto/provider_conf.c
parentx509: use safe maths calls for overflow detection (diff)
downloadopenssl-ed5b26ce0b34ec00bdd53d15854a22bccbb4d415.tar.xz
openssl-ed5b26ce0b34ec00bdd53d15854a22bccbb4d415.zip
Add return value NULL checks that were missing
Issues located by Brian Carpenter of Geeknik's Farm. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17007)
Diffstat (limited to 'crypto/provider_conf.c')
-rw-r--r--crypto/provider_conf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/provider_conf.c b/crypto/provider_conf.c
index da3796d914..054261771a 100644
--- a/crypto/provider_conf.c
+++ b/crypto/provider_conf.c
@@ -146,9 +146,6 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name,
const char *path = NULL;
long activate = 0;
int ok = 0;
- PROVIDER_CONF_GLOBAL *pcgbl
- = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_CONF_INDEX,
- &provider_conf_ossl_ctx_method);
name = skip_dot(name);
OSSL_TRACE1(CONF, "Configuring provider %s\n", name);
@@ -185,7 +182,11 @@ static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name,
}
if (activate) {
- if (!CRYPTO_THREAD_write_lock(pcgbl->lock)) {
+ PROVIDER_CONF_GLOBAL *pcgbl
+ = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_CONF_INDEX,
+ &provider_conf_ossl_ctx_method);
+
+ if (pcgbl == NULL || !CRYPTO_THREAD_write_lock(pcgbl->lock)) {
ERR_raise(ERR_LIB_CRYPTO, ERR_R_INTERNAL_ERROR);
return 0;
}