]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: peers: reject message lengths above 32 bits before truncation 20261023-fle-peers-bugfixes
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 22 Oct 2026 13:57:44 +0000 (15:57 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 26 Oct 2026 15:30:43 +0000 (16:30 +0100)
commit109925d2515fc2ff256856780b463b2557f60079
tree0f934c93843886c765db05281305e370322ce582
parent979b64f940edfe7db28222694c2878f32a6a16a4
BUG/MINOR: peers: reject message lengths above 32 bits before truncation

peer_recv_msg() decodes the stick-table message length with intdecode(),
which returns a 64-bit value, and stores it into a uint32_t before
checking it against the buffer size. The length is encoded on at most 5
bytes here, so it can reach 4328786159 (2^32 + 33818863). Such values
wrap to 0..33818863 when truncated, pass the size check, and desync the
parsing of the stream instead of being rejected.

Decode into a 64-bit local variable and compare it to trash.size before
storing it, so oversized lengths are now reported as ERRSIZE.

This only triggers on a malformed length sent by a configured peer,
i.e. a buggy or malicious one: a compliant peer never encodes such a
value, and peer sessions are expected to run on trusted networks. The
impact is limited to garbling that session; there is no buffer write
overflow, as only the truncated length is ever used to read data.

This has been there for a long time and can be backported to all stable.
src/peers.c