summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authoratishkov <a.tishkov@aladdin.ru>2023-07-21 11:36:37 +0300
committerTomas Mraz <tomas@openssl.org>2023-07-25 17:05:08 +0200
commit33d03540d7c54e75d3d645b19ea7142782974b86 (patch)
tree480440e3e4c101a647a9b11cb1daa3dde25fd439 /crypto
parentb3730d03bac77a86a6f32408d0728211ef196dcb (diff)
get_cert_by_subject_ex(): Check result of X509_STORE_lock()
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21515) (cherry picked from commit bc5d9cc8711e86d5c25b81c58dfae531536e61fc)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/x509/by_dir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index 97e6ea0ee1..63213ca2c8 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -349,7 +349,8 @@ static int get_cert_by_subject_ex(X509_LOOKUP *xl, X509_LOOKUP_TYPE type,
* we have added it to the cache so now pull it out again
*/
if (k > 0) {
- X509_STORE_lock(xl->store_ctx);
+ if (!X509_STORE_lock(xl->store_ctx))
+ goto finish;
j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp);
tmp = sk_X509_OBJECT_value(xl->store_ctx->objs, j);
X509_STORE_unlock(xl->store_ctx);