]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: http: prevent redirect from overwriting a buffer
authorThierry FOURNIER <thierry.fournier@ozon.io>
Sat, 28 Jan 2017 06:39:53 +0000 (07:39 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Feb 2017 10:16:46 +0000 (11:16 +0100)
commit0d94576c74a4e6cef050b6cddb513fd9a363cf6c
tree27406c3e00e1239c330c89c00e1697a0485acfa8
parentb686afd56817316a42529330a6b59c07708c2a37
BUG/MEDIUM: http: prevent redirect from overwriting a buffer

See 4b788f7d349ddde3f70f063b7394529eac6ab678

If we use the action "http-request redirect" with a Lua sample-fetch or
converter, and the Lua function calls one of the Lua log function, the
header name is corrupted, it contains an extract of the last loggued data.

This is due to an overwrite of the trash buffer, because his scope is not
respected in the "add-header" function. The scope of the trash buffer must
be limited to the function using it. The build_logline() function can
execute a lot of other function which can use the trash buffer.

This patch fix the usage of the trash buffer. It limits the scope of this
global buffer to the local function, we build first the header value using
build_logline, and after we store the header name.

Thanks Jesse Schulman for the bug repport.

This patch must be backported in 1.7, 1.6 and 1.5 version, and it relies
on commit b686afd ("MINOR: chunks: implement a simple dynamic allocator for
trash buffers") for the trash allocator, which has to be backported as well.
src/proto_http.c