]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: payload: distcc_body must not sample unreceived buffer bytes master
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Nov 2026 16:36:16 +0000 (17:36 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Nov 2026 16:47:14 +0000 (17:47 +0100)
commitdef1690d39305457c46b0f5a020cd7887aa8b796
treef8a2e2dc7dba323f84d86b3e36cd9b0ddf7371dc
parent383e07a8787ab9f838158daf74c0d75961bb133e
BUG/MINOR: payload: distcc_body must not sample unreceived buffer bytes

When the declared body of a distcc token is longer than the data actually
received but still fits within the channel's receive limit,
smp_fetch_distcc_body() truncates the sample to channel_recv_limit() instead
of ci_data(). The sample then covers a range of the buffer that has not been
filled by the current connection, exposing stale bytes left by a previous
connection using the same pooled buffer, e.g. via ACLs, set-var, log-format
or header insertion.

In addition, the incomplete-body check mixed reference frames: ofs is
relative to the input head, but was compared against ci_head() - b_orig() +
ci_data(), which is only equivalent when the input head sits at the buffer
origin. With bytes already forwarded, a body extending past the received
data could be considered complete.

Both issues are fixed by comparing and truncating against ci_data(), the
amount of input data actually received, and by always setting
SMP_F_MAY_CHANGE on truncated bodies so the rules are re-evaluated once more
data arrives.

This patch should fix the issue #3583. It must be backported to all
supported versions.
src/payload.c