]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: proxy: do not dereference strm_li(stream)
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Sep 2015 10:20:10 +0000 (12:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 23 Sep 2015 11:42:08 +0000 (13:42 +0200)
Some streams do not have a listener (eg: Lua's cosockets) so
let's check for this. For now this problem cannot happen but
it's definitely unsafe.

src/proxy.c

index b690a81febcd6d448f92ca04f43ad90fa44cee0e..fb62b7c044052c68b40bd1f6477a6bbbfa01b772 100644 (file)
@@ -1141,7 +1141,9 @@ int stream_set_backend(struct stream *s, struct proxy *be)
         * be more reliable to store the list of analysers that have been run,
         * but what we do here is OK for now.
         */
-       s->req.analysers |= be->be_req_ana & ~strm_li(s)->analysers;
+       s->req.analysers |= be->be_req_ana;
+       if (strm_li(s))
+               s->req.analysers &= ~strm_li(s)->analysers;
 
        /* If the target backend requires HTTP processing, we have to allocate
         * the HTTP transaction and hdr_idx if we did not have one.