BUG/MAJOR: stick-counters: possible crash when using sc_trackers with wrong table
authorWilly Tarreau <w@1wt.eu>
Sun, 14 Aug 2016 10:02:55 +0000 (12:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 14 Aug 2016 10:02:55 +0000 (12:02 +0200)
commit4d03ef7f0319c5f73cbcb1d5c3025923226a1536
treee85005404c685e38831fe363ad0a23e1c31ba11a
parent597b26e4329133c605729c4a67322ed43449fbe0
BUG/MAJOR: stick-counters: possible crash when using sc_trackers with wrong table

Bryan Talbot reported a very interesting bug. The sc_trackers() sample
fetch seems to have escaped the sanitization that was performed during 1.5
to ensure all dereferences of stkctr_entry() were safe. Here if a tacker
is set on a backend and is then checked against a different backend where
the entry doesn't exist, stkctr_entry() returns NULL and this is dereferenced
to retrieve the ref count. Thanks to Bryan for his detailed bug report featuring
a working config and reproducer.

This fix must be backported to 1.6 and 1.5.
src/stream.c