]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http_ana: fix potential NULL deref in http_process_req_common()
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 15 Sep 2025 07:22:19 +0000 (09:22 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 15 Sep 2025 08:28:59 +0000 (10:28 +0200)
As reported by @kenballus in GH #3118, a potential NULL-deref was
introduced in 3da1d63 ("BUG/MEDIUM: http_ana: handle yield for "stats
http-request" evaluation")

Indeed, px->uri_auth may be NULL when stats directive is not involved in
the current proxy section.

The bug went unnoticed because it didn't seem to cause any side-effect
so far and valgrind didn't catch it. However ASAN did, so let's fix it
before it causes harm.

It should be backported with 3da1d63.

src/http_ana.c

index 72a967d4657be1a18f9ff3ef3b7f42e77d14eff2..b7b0b2f20990d908dc9f86ce74fa776c23a47739 100644 (file)
@@ -399,7 +399,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
 
        verdict = HTTP_RULE_RES_CONT;
 
-       if (s->current_rule_list == &px->uri_auth->http_req_rules)
+       if (px->uri_auth && s->current_rule_list == &px->uri_auth->http_req_rules)
                stats_rules = 1;
 
        /* resume stats http-request rules if needed */