]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: http: fix the 'next' pointer when performing a redirect
authorWilly Tarreau <w@1wt.eu>
Fri, 25 Apr 2014 10:19:32 +0000 (12:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 25 Apr 2014 10:21:09 +0000 (12:21 +0200)
Commit bed410e ("MAJOR: http: centralize data forwarding in the request path")
has woken up an issue in redirects, where msg->next is not reset when flushing
the input buffer. The result is an attempt to forward a negative amount of
data, making haproxy crash.

This bug does not seem to affect versions prior to dev23, so no backport is
needed.

src/proto_http.c

index 8d42a1d50bb9a8beba50f8784078f3ff797e8dd1..3675b85aa1fe17bb191e5c3c7ab8539e0265f5d0 100644 (file)
@@ -3530,6 +3530,7 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct session *
                bo_inject(txn->rsp.chn, trash.str, trash.len);
                /* "eat" the request */
                bi_fast_delete(txn->req.chn->buf, msg->sov);
+               msg->next -= msg->sov;
                msg->sov = 0;
                txn->req.chn->analysers = AN_REQ_HTTP_XFER_BODY;
                s->rep->analysers = AN_RES_HTTP_XFER_BODY;