]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: http: Return an error when url_dec sample converter failed
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 5 Oct 2017 08:03:12 +0000 (10:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Oct 2017 09:11:34 +0000 (11:11 +0200)
commita258479e3fe17fc525d3c82b23e26e311453fd56
treeb789ffd6d12d4f8079d9f478a716766e29898e5d
parent017af2477eb478e95b2e2e09e3daffaf34979f2d
BUG/MEDIUM: http: Return an error when url_dec sample converter failed

url_dec sample converter uses url_decode function to decode an URL. This
function fails by returning -1 when an invalid character is found. But the
sample converter never checked the return value and it used it as length for the
decoded string. Because it always succeeded, the invalid sample (with a string
length set to -1) could be used by other sample fetches or sample converters,
leading to undefined behavior like segfault.

The fix is pretty simple, url_dec sample converter just needs to return an error
when url_decode fails.

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