BUG/MEDIUM: session: NULL dereference possible when accessing the listener
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 8 Mar 2021 14:26:48 +0000 (15:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 10 Mar 2021 13:05:49 +0000 (14:05 +0100)
commit656730d92f1c3afaed0baf67911d4ee055528e2e
tree676f1b580898ab440977cab6d368abcde93eb5fc
parented9883e06149d7112a7ac27e2000866958d2d902
BUG/MEDIUM: session: NULL dereference possible when accessing the listener

When implementing a client applet, a NULL dereference was encountered on
the error path which increment the counters.

Indeed, the counters incremented are the one in the listener which does
not exist in the case of client applets, so in sess->listener->counters,
listener is NULL.

This patch fixes the access to the listener structure when accessing
from a sesssion, most of the access are the counters in error paths.

Must be backported as far as 1.8.

(cherry picked from commit 36119de182154b1f87e0cdf4bd1efba9e2e64113)
[wt: minor ctx adjustments in http_ana and mux_h1]
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/fcgi-app.c
src/http_act.c
src/http_ana.c
src/tcp_act.c
src/tcp_rules.c