]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: listener: Fix a possible null pointer dereference
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Sep 2019 08:01:26 +0000 (10:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Sep 2019 08:29:54 +0000 (10:29 +0200)
It seems to be possible to have no frontend for a listener. A test was missing
before dereferencing it at the end of the function listener_accept().

This patch fixes the issue #264. It must be backported to 2.0 and 1.9.

src/listener.c

index 54c099602194e8f19b37c058e3c6d1c2da9e19a7..33ac6ce1194a5018709cb0f61052ab248d888982 100644 (file)
@@ -1065,7 +1065,7 @@ void listener_accept(int fd)
                if (!LIST_ISEMPTY(&global_listener_queue))
                        dequeue_all_listeners(&global_listener_queue);
 
-               if (!LIST_ISEMPTY(&p->listener_queue) &&
+               if (p && !LIST_ISEMPTY(&p->listener_queue) &&
                    (!p->fe_sps_lim || freq_ctr_remain(&p->fe_sess_per_sec, p->fe_sps_lim, 0) > 0))
                        dequeue_all_listeners(&p->listener_queue);
        }