BUG/MEDIUM: http: add-header: buffer overwritten
authorThierry Fournier <thierry.fournier@ozon.io>
Wed, 1 Jun 2016 11:35:36 +0000 (13:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Jun 2016 08:34:22 +0000 (10:34 +0200)
commit4b788f7d349ddde3f70f063b7394529eac6ab678
tree0a9b9537ee5ca6420d56be7615cfb2852ec4a557
parent53c1a9b7cb8f3fe79b5492218363b6c0ff608fc1
BUG/MEDIUM: http: add-header: buffer overwritten

If we use the action "http-request add-header" 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 Michael Ezzell for the repporting.

This patch must be backported in 1.6 version
src/proto_http.c