Skip to content

modules/md/md_acme_acct.c (find_acct): Do not dereference a NULL md in the debug log - #764

Closed
PavlNekrasov wants to merge 1 commit into
apache:trunkfrom
PavlNekrasov:fix/md-acme-acct-null-md
Closed

PavlNekrasov wants to merge 1 commit into
apache:trunkfrom
PavlNekrasov:fix/md-acme-acct-null-md

Conversation

@PavlNekrasov

Copy link
Copy Markdown

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.

if (MD_ACME_ACCT_ST_VALID == acct->status
&& (!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);

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

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
@notroj

notroj commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

LGTM, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants