]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: acme: fix possible NULL deref
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 15 Apr 2025 09:36:26 +0000 (11:36 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 15 Apr 2025 09:41:58 +0000 (11:41 +0200)
Task was dereferenced when setting ctx but was checked after.
This patch move the setting of ctx after the check.

Should fix issue #2931

src/acme.c

index c3ee3cd331d2be6eb0a3dddc106f106e79b1876e..ce7f9684e342b878a933e040adf31c814753de45 100644 (file)
@@ -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;