summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-08-16 16:29:01 +0200
committerTomas Mraz <tomas@openssl.org>2023-08-18 15:06:18 +0200
commit6404d064b8012a2c353603a3b3effa6289313d61 (patch)
treebd3c70e4b2a693d601f65709f4ca0db2979a1ed8 /crypto
parent2b2eedfdd614e4c5e2104acf44da0bcdd5b90ade (diff)
ossl_x509_store_ctx_get_by_subject(): Check return value of X509_STORE_lock()
Fixes Coverity 1539148 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21755)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/x509/x509_lu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index 08b8425bbe..c639b54a54 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -339,7 +339,8 @@ static int ossl_x509_store_ctx_get_by_subject(const X509_STORE_CTX *ctx,
if (!sk_X509_OBJECT_is_sorted(store->objs)) {
X509_STORE_unlock(store);
/* Take a write lock instead of a read lock */
- X509_STORE_lock(store);
+ if (!X509_STORE_lock(store))
+ return 0;
/*
* Another thread might have sorted it in the meantime. But if so,
* sk_X509_OBJECT_sort() exits early.