]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stream: do not dereference strm_li(stream)
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Sep 2015 10:21:21 +0000 (12:21 +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/stream.c

index 6c1f7ab84beae5352c860ff3a0cbd586a276303d..5583d1d40e6090b1a60bd893a2670f401e7ba9cd 100644 (file)
@@ -934,7 +934,7 @@ static void sess_set_term_flags(struct stream *s)
                if (s->si[1].state < SI_ST_REQ) {
 
                        strm_fe(s)->fe_counters.failed_req++;
-                       if (strm_li(s)->counters)
+                       if (strm_li(s) && strm_li(s)->counters)
                                strm_li(s)->counters->failed_req++;
 
                        s->flags |= SF_FINST_R;