]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: http-ana: Get a fresh trash buffer for each header value replacement
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Aug 2023 14:51:11 +0000 (16:51 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Aug 2023 15:06:31 +0000 (17:06 +0200)
commit624979cf3bc3b30a8d0e2d959863345d9b8d2145
treee160acd28d481af5a58988c445811470c629c53e
parent559482c11e605b0f19714e47368a9a5ccbdca3cb
BUG/MAJOR: http-ana: Get a fresh trash buffer for each header value replacement

When a "replace-header" action is used, we loop on all headers in the
message to change value of all headers matching a name. The new value is
placed in a trash. However, there is a race here because if the message must
be defragmented, another trash is used. If several defragmentation are
performed because several headers must be updated at same time, the first
trash, used to store the new value, may be crushed. Indeed, there are only 2
pre-allocated trash used in rotation. and the trash to store the new value
is never renewed. As consequece, random data may be inserted into the header
value.

Here, to fix the issue, we must take care to refresh the trash buffer when
we evaluated a new header. This way, a trash used for the new value, and
eventually another way for the htx defragmentation. But that's all.

Thanks to Christian Ruppert for his detailed report.

This patch must be to all stable versions. On the 2.0, the patch must be
applied on src/proto_htx.c and the function is named
htx_transform_header_str().
src/http_ana.c