From: Willy Tarreau Date: Wed, 3 Oct 2018 08:20:19 +0000 (+0200) Subject: BUG/MINOR: backend: check that the mux installed properly X-Git-Tag: v1.9-dev4~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33dd4ef81245bb868b22f99b9be45d0791131eec;p=thirdparty%2Fhaproxy.git BUG/MINOR: backend: check that the mux installed properly The return value from conn_install_mux() was not checked, so if an inconsistency happens in the code, or a memory allocation fails while initializing the mux, we can crash while using an uninitialized mux. In practice the code inconsistency does not really happen since we cannot configure such a situation, except during development, but the out of memory condition could definitely happen. This should be backported to 1.8 (the code is a bit different there, there are two calls to conn_install_mux()). --- diff --git a/src/backend.c b/src/backend.c index e66ee4a4b0..b154b80457 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1189,7 +1189,8 @@ int connect_server(struct stream *s) else return SF_ERR_INTERNAL; /* how did we get there ? */ - conn_install_mux_be(srv_conn, srv_cs); + if (conn_install_mux_be(srv_conn, srv_cs) < 0) + return SF_ERR_INTERNAL; /* process the case where the server requires the PROXY protocol to be sent */ srv_conn->send_proxy_ofs = 0;