]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mux-h2: fix the body_len to check when parsing request trailers
authorWilly Tarreau <w@1wt.eu>
Mon, 4 May 2026 11:42:52 +0000 (13:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 May 2026 12:33:22 +0000 (14:33 +0200)
commitb6995d25d1b694f52d1f23463532680b484c775f
tree2a8770387099fb8c80fd33bc863e7f94fcf754db
parenta8b1af277f19acd99c7284c8733abff4bbafe914
BUG/MEDIUM: mux-h2: fix the body_len to check when parsing request trailers

The h2 content-length validation in commit d12edebe4a ("BUG/MAJOR:
mux-h2: detect incomplete transfers on HEADERS frames as well") was
insufficient. The content-length check is still ineffective on request
trailers and it could not work by default due to the fact that the
default body_len is used in h2c_frt_handle_headers() when processing
trailers, instead of passing h2s->body_len, which was necessarily parsed
before reaching trailers. Let's fix this point first, otherwise fixing
the second issue would break trailers.

Many thanks to Pratham Gupta / alchemy1729 for spotting and analyzing
this problem, and for providing a lightweight reproducer to illustrate
the problem!

This fix must be backported to all versions where the fix above was
backported (i.e. all).
src/mux_h2.c