From: William Lallemand Date: Tue, 15 Apr 2025 09:36:26 +0000 (+0200) Subject: BUG/MINOR: acme: fix possible NULL deref X-Git-Tag: v3.2-dev11~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3866d3bd12bc27ebb94c76e7e1be39bf916ee8c3;p=thirdparty%2Fhaproxy.git BUG/MINOR: acme: fix possible NULL deref Task was dereferenced when setting ctx but was checked after. This patch move the setting of ctx after the check. Should fix issue #2931 --- diff --git a/src/acme.c b/src/acme.c index c3ee3cd33..ce7f9684e 100644 --- a/src/acme.c +++ b/src/acme.c @@ -493,11 +493,13 @@ REGISTER_CONFIG_SECTION("acme", cfg_parse_acme, cfg_postsection_acme); static void acme_httpclient_end(struct httpclient *hc) { struct task *task = hc->caller; - struct acme_ctx *ctx = task->context; + struct acme_ctx *ctx; if (!task) return; + ctx = task->context; + if (ctx->http_state == ACME_HTTP_REQ) ctx->http_state = ACME_HTTP_RES;