From: Christopher Faulet Date: Thu, 3 Dec 2026 10:02:52 +0000 (+0100) Subject: BUG/MINOR: flt-trace: consume the whole block size when dumping HTX data X-Git-Url: https://git.kaiwu.me/web/http/static/%7B@url%7D?a=commitdiff_plain;h=126ef1b8677ab2d956138e6c29640180397dfa28;p=haproxy.git BUG/MINOR: flt-trace: consume the whole block size when dumping HTX data In trace_htx_hexdump(), the remaining length to dump was decremented by the length of the block value instead of the block size. But the length is expressed in bytes of the HTX message. For a block without value or with a value smaller than the block itself, like a NOOP block, the length was not decremented accordingly and the dump could go beyond the forwarded data. For instance, with a NOOP block in the middle of the payload, one extra byte of the next DATA block was dumped. Now the whole block size, minus the offset, is consumed. This patch must be backported to 3.5. --- diff --git a/src/flt_trace.c b/src/flt_trace.c index a51d92867..6a4e11452 100644 --- a/src/flt_trace.c +++ b/src/flt_trace.c @@ -143,12 +143,19 @@ trace_htx_hexdump(struct htx *htx, unsigned int offset, unsigned int len) continue; } + /* is a number of bytes in the HTX message, so the whole + * block size must be consumed, whatever the length of its value + * (e.g. NOOP blocks have no value but a size of 1 byte). + */ + sz -= offset; + if (sz > len) + sz = len; + len -= sz; + v = htx_get_blk_value(htx, blk); v = istadv(v, offset); offset = 0; - - v = isttrim(v, len); - len -= v.len; + v = isttrim(v, sz); if (htx_is_data_type(type)) trace_hexdump(v); }