mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
Commit bc4c1ac ("MEDIUM: http/tcp: permit to resume http and tcp custom actions") introduced the ability to interrupt and restart processing in the middle of a TCP/HTTP ruleset. But it doesn't do it in a consistent way : it checks current_rule_list, immediately dereferences current_rule, which is only set in certain cases and never cleared. So that broke the tcp-request content rules when the processing was interrupted due to missing data, because current_rule was not yet set (segfault) or could have been inherited from another ruleset if it was used in a backend (random behaviour). The proper way to do it is to always set current_rule before dereferencing it. But we don't want to set it for all rules because we don't want any action to provide a checkpointing mechanism. So current_rule is set to NULL before entering the loop, and only used if not NULL and if current_rule_list matches the current list. This way they both serve as a guard for the other one. This fix also makes the current rule point to the rule instead of its list element, as it's much easier to manipulate. No backport is needed, this is 1.6-specific.