From a0e16066a38322a3829f72605cfaf5a2890a9b4a Mon Sep 17 00:00:00 2001
From: Pavel Nekrasov
Date: Thu, 17 Sep 2026 17:04:26 +0300
Subject: [PATCH] Fix: DEREF_AFTER_NULL
Problem:
find_acct() accepts a candidate account when ctx->md is NULL, and
dereferences ctx->md in the very next statement to log it. The two lines
contradict each other, so the NULL that the condition admits crashes the
logging call.
Solution:
Log the CA only when there is an md, keeping the NULL that the condition
already allows.
Signed-off-by: p.nekrasov@fobos-nt.ru
Signed-off-by: sovtouch@altlinux.org
---
modules/md/md_acme_acct.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/md/md_acme_acct.c b/modules/md/md_acme_acct.c
index 3fd768b2338..292a56623fb 100644
--- a/modules/md/md_acme_acct.c
+++ b/modules/md/md_acme_acct.c
@@ -284,7 +284,8 @@ static int find_acct(void *baton, const char *name, const char *aspect,
&& (!ctx->md || md_acme_acct_matches_md(acct, ctx->md))) {
md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, 0, ctx->p,
"found account %s for %s: %s, status=%d",
- acct->id, ctx->md->ca_effective, aspect, acct->status);
+ acct->id, ctx->md? ctx->md->ca_effective : "(none)",
+ aspect, acct->status);
ctx->id = apr_pstrdup(ctx->p, name);
return 0;
}