]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ossl_x509_store_ctx_get_by_subject(): Check return value of X509_STORE_lock()
authorTomas Mraz <tomas@openssl.org>
Wed, 16 Aug 2023 14:29:01 +0000 (16:29 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 18 Aug 2023 13:06:18 +0000 (15:06 +0200)
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)

crypto/x509/x509_lu.c

index 08b8425bbe40bf519374d40f16741f8f0b146af4..c639b54a543c8b04d1b2f914ea3acc0f0f430443 100644 (file)
@@ -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.