]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: connection: reserve the whole CRC32C TLV before saving its pointer
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Aug 2026 07:27:02 +0000 (09:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Aug 2026 11:54:14 +0000 (13:54 +0200)
commit2d74dd7e9eb76dc50513f2b12f513e215de1bea4
tree3730fcd4684054932ff5a030d14c202f5b98d045
parente088b0d8e38738ce5cc19a4e3fd44b3d3599c6f5
BUG/MINOR: connection: reserve the whole CRC32C TLV before saving its pointer

make_proxy_line_v2() saves a pointer to the CRC32C TLV value so the
checksum can be appended once the whole header is known. It only checked
for 3 bytes (the TLV header) instead of the 7 needed for the full TLV, so
with 3 to 6 bytes left, make_tlv() emitted nothing and returned 0, yet
tlv_crc32c_p was still set, and the final write_u32() wrote 4 bytes up to
3 bytes past the end of the header buffer.

Not only this theoretically only affects servers using "send-proxy-v2"
with "proxy-v2-options crc32c" combined with "set-proxy-v2-tlv-fmt" TLVs,
but in addition in practice the proxy protocol is designed to be way
shorter than a regular buffer, and the only practical way to reach that
is to purposely write a config to demonstrate this, so it cannot happen.

This has been there since crc32c support was added in 1.9 by commit
4399c75f6 ("MINOR: proxy-v2-options: add crc32c"). It should be backported
to all stable versions.

Reported-by: Claude (ANT-2026-H10QWEV6)
src/connection.c