From: Felipe Guerreiro Barbosa Ruiz Date: Thu, 16 Mar 2017 20:01:41 +0000 (-0300) Subject: BUG: payload: fix payload not retrieving arbitrary lengths X-Git-Tag: v1.8-dev1~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00f55524e0b215e17d82a00c0faa58efc8eafd81;p=thirdparty%2Fhaproxy.git BUG: payload: fix payload not retrieving arbitrary lengths 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. --- diff --git a/src/payload.c b/src/payload.c index a02a869660..b80a19c919 100644 --- a/src/payload.c +++ b/src/payload.c @@ -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;