]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: http-htx: don't build the new authority in a rotating trash chunk
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 04:32:55 +0000 (04:32 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 12:05:25 +0000 (14:05 +0200)
commit0b5ebc47c52c48be83cf3dca6847e866a2f9850f
tree7864b945f6b33528faee276ca80d9a8ef9f5ea0f
parentcf9670997ad9ad018ad5e85bd1542e5c186ade7f
BUG/MEDIUM: http-htx: don't build the new authority in a rotating trash chunk

When the host header value is replaced, the authority of the URI, if any, is
updated from the new value. Since commit 632b54ebf ("BUG/MEDIUM: http-htx:
Don't use data from HTX message to update authority"), this new value is the
one passed by the caller.

However, http_update_authority() function was relying on a rotating trash
chunk to build the new start-line. So it was possible to crush still in-use
data, in that case the new host header value. This could happen when the HTX
message had to be be defragmented. Because of this issue it was possible to
produce an invalid message for any request carrying an authority in its URI,
i.e. every H2 or H3 request and the H1 absolute-form ones, as soon as the
client sended headers large enough to require a defrag.

To fix it, http_update_authority() now builds the start-line into a
dedicated chunk obtained with alloc_trash_chunk(). This protects every
caller, whatever the storage of <host>. A reg-test was added which removes a
large header to leave a hole, then makes the host header grow, for several
sizes of a filler header.

This must be backported to all supported versions.
reg-tests/http-rules/replace_header_host_authority.vtc [new file with mode: 0644]
src/http_htx.c