From: Willy Tarreau Date: Thu, 24 Sep 2015 14:33:10 +0000 (+0200) Subject: BUG/MEDIUM: payload: make req.payload and payload_lv aware of dynamic buffers X-Git-Tag: v1.6-dev6~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7bdcb874bcb;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: payload: make req.payload and payload_lv aware of dynamic buffers Due to a check between offset+len and buf->size, an empty buffer returns "will never match". Check against tune.bufsize instead. (cherry picked from commit 43e4039fd5d208fd9d32157d20de93d3ddf9bc0d) --- diff --git a/src/payload.c b/src/payload.c index 378927a7d8..71d3ec00f7 100644 --- a/src/payload.c +++ b/src/payload.c @@ -670,7 +670,7 @@ smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw buf_offset = arg_p[2].data.sint >> 1; } - if (!buf_size || buf_size > chn->buf->size || buf_offset + buf_size > chn->buf->size) { + if (!buf_size || buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) { /* will never match */ smp->flags = 0; return 0; @@ -702,7 +702,7 @@ smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, v if (!chn->buf) return 0; - if (buf_size > chn->buf->size || buf_offset + buf_size > chn->buf->size) { + if (!buf_size || buf_size > global.tune.bufsize || buf_offset + buf_size > global.tune.bufsize) { /* will never match */ smp->flags = 0; return 0;