From: Willy Tarreau Date: Tue, 8 May 2012 13:20:43 +0000 (+0200) Subject: BUG/MEDIUM: send_proxy: fix initialisation of send_proxy_ofs X-Git-Tag: v1.5-dev9~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63e7fe310ef50625faeecb2fa41fa3914a24f577;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: send_proxy: fix initialisation of send_proxy_ofs Commit b22e55bc introduced send_proxy_ofs but forgot to initialize it, which remained unnoticed since it's always at the same place in the stream interface. On a machine with dirty RAM returned by malloc(), some responses were holding a PROXY header, which normally is not possible. The problem goes away after properly initializing the field upon each new session_accept(). This fix does not need to be backported except if any code makes use of a backport of this feature. --- diff --git a/src/peers.c b/src/peers.c index ba57e1868f..182d71d23e 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1156,6 +1156,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio s->si[0].err_loc = NULL; s->si[0].proto = NULL; s->si[0].release = NULL; + s->si[0].send_proxy_ofs = 0; clear_target(&s->si[0].target); s->si[0].exp = TICK_ETERNITY; s->si[0].flags = SI_FL_NONE; @@ -1174,6 +1175,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio s->si[1].err_loc = NULL; s->si[1].proto = peer->proto; s->si[1].release = NULL; + s->si[1].send_proxy_ofs = 0; set_target_proxy(&s->si[1].target, s->be); s->si[1].exp = TICK_ETERNITY; s->si[1].flags = SI_FL_NONE; diff --git a/src/session.c b/src/session.c index af3a464420..862af58530 100644 --- a/src/session.c +++ b/src/session.c @@ -171,6 +171,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->si[0].err_loc = NULL; s->si[0].proto = l->proto; s->si[0].release = NULL; + s->si[0].send_proxy_ofs = 0; clear_target(&s->si[0].target); s->si[0].exp = TICK_ETERNITY; s->si[0].flags = SI_FL_NONE; @@ -195,6 +196,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->si[1].err_loc = NULL; s->si[1].proto = NULL; s->si[1].release = NULL; + s->si[1].send_proxy_ofs = 0; clear_target(&s->si[1].target); s->si[1].sock.shutr= stream_int_shutr; s->si[1].sock.shutw= stream_int_shutw;