]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: http-conv: Fix url_enc() to not crush const samples
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 8 Apr 2022 08:04:05 +0000 (10:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 8 Apr 2022 08:12:59 +0000 (10:12 +0200)
commit21ac0eec280685174fbe368c4da0cb9cb8efd075
tree1b51ca20227214cb072073787045dead0b5ce7b4
parentdca3b5b2c6618860b305b48b5c55abe2877be832
BUG/MEDIUM: http-conv: Fix url_enc() to not crush const samples

url_enc() encodes an input string by calling encode_string(). To do so, it
adds a trailing '\0' to the sample string. However it never restores the
sample string at the end. It is a problem for const samples. The sample
string may be in the middle of a buffer. For instance, the HTTP headers
values are concerned.

However, instead of modifying the sample string, it is easier to rely on
encode_chunk() function. It does the same but on a buffer.

This patch must be backported as far as 2.2.
src/http_conv.c