]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stream: Fix crash in stream dump if the current rule has no keyword
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Mar 2026 07:31:31 +0000 (08:31 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Mar 2026 07:39:49 +0000 (08:39 +0100)
The commit 9f1e9ee0e ("DEBUG: stream: Display the currently running rule in
stream dump") revealed a bug. When a stream is dumped, if it is blocked on a
rule, we must take care the rule has a keyword to display its name.

Indeed, some action parsings are inlined with the rule parser. In that case,
there is no keyword attached to the rule.

Because of this bug, crashes can be experienced when a stream is
dumped. Now, when there is no keyword, "?" is display instead.

This patch must be backported as far as 2.6.

src/stream.c

index 2382c4a369fa37d1d2e9f36533741937f0b1d250..cb26fb68c37817e5ce716b1e763ad712d425824a 100644 (file)
@@ -3841,7 +3841,7 @@ static void __strm_dump_to_buffer(struct buffer *buf, const struct show_sess_ctx
        if (strm->current_rule_list && strm->current_rule) {
                const struct act_rule *rule = strm->current_rule;
                chunk_appendf(buf, "%s  current_rule=\"%s\" [%s:%d] (%s)\n",
-                             pfx, rule->kw->kw, rule->conf.file, rule->conf.line,
+                             pfx, rule->kw ? rule->kw->kw : "?", rule->conf.file, rule->conf.line,
                              (rule == strm->waiting_entity.ptr) ? "YIELDING" : "RUNNING");
        }
 }