From 325aaa4d24f222a66bb234eddb11d288371b724c Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Wed, 5 Jun 2024 08:44:40 +0200 Subject: [PATCH] check cert_store pointer --- src/tls/openssl/tls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tls/openssl/tls.c b/src/tls/openssl/tls.c index 0d28a5edf..b182b74ef 100644 --- a/src/tls/openssl/tls.c +++ b/src/tls/openssl/tls.c @@ -1997,8 +1997,10 @@ int tls_add_certf(struct tls *tls, const char *certf, const char *host) goto err; X509_STORE *ca = SSL_CTX_get_cert_store(tls->ctx); - X509_STORE_up_ref(ca); - SSL_CTX_set_cert_store(uc->ctx, ca); + if (ca) { + X509_STORE_up_ref(ca); + SSL_CTX_set_cert_store(uc->ctx, ca); + } list_append(&tls->certs, &uc->le, uc); if (list_count(&tls->certs) == 1)