]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: payload: fix payload not retrieving arbitrary lengths
authorFelipe Guerreiro Barbosa Ruiz <felipe.ruiz@olxbr.com>
Thu, 16 Mar 2017 20:01:41 +0000 (17:01 -0300)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Mar 2017 06:25:37 +0000 (07:25 +0100)
This fixes a regression introduced in d7bdcb874bcb, that removed the
ability to use req.payload(0,0) to read the whole buffer content. The
offending commit is present starting in version 1.6, so the patch
should be backported to versions 1.6 and 1.7.

src/payload.c

index a02a869660518cbd5ab7950d02ff24b728b5a02b..b80a19c91909ba01623a829e9d5f984f9fc3f768 100644 (file)
@@ -838,7 +838,7 @@ smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, v
                return 0;
 
        chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
-       if (!buf_size || buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) {
+       if (buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) {
                /* will never match */
                smp->flags = 0;
                return 0;