]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: log: fix risk of segfault when logging HTTP fields in TCP mode
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2016 15:09:40 +0000 (17:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Apr 2016 15:15:58 +0000 (17:15 +0200)
commit57bc8917c31ec34f0ac3e12a2738a7166e58ee5e
treeb9b087b40274c5f4a2e287e9a0a0d182fd4acef1
parent169c47028a0e897fff12d7454d8254c17b68562e
BUG/MEDIUM: log: fix risk of segfault when logging HTTP fields in TCP mode

David Torgerson faced an issue when using HTTP fields in log-format in TCP
sections. The txn is dereferenced while it's null, resulting in a crash of
the process. Such configurations are invalid and a warning is emitted, but
nevertheless the process must not crash. As found by Lukas Tribus, this is
a side effect of the split between the stream and the HTTP transaction that
happened in 1.6, making it possible to have txn==NULL there.

The fix consists in checking that txn is valid before using it. Fortunately
it's easy since almost all places already used to check for the existence
of a field (eg: txn->uri).

This patch should be backported to 1.6.
src/log.c