BUG/MEDIUM: mux-h2: Check the number of headers in HEADERS frame after decoding
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 20 Nov 2024 15:27:34 +0000 (16:27 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 Nov 2024 14:46:55 +0000 (15:46 +0100)
commit0777b7dded26b3584a5b05fa93867224371750c5
treee9f84efcfdaa726b8b9e1c47cdaf376009b8da67
parente9ad14e73d9fa0f2bdffb841bb23fbe27ab5a4f1
BUG/MEDIUM: mux-h2: Check the number of headers in HEADERS frame after decoding

There is no explicit test on the number of headers when a HEADERS frame is
received. It is implicitely limited by the size of the header list. But it
is twice the configured limit to be sure to decode the frame.

So now, a check is performed after the HTX message was created. This way, we
are sure to not exceed the configured limit after the decoding stage. If
there are too many headers, a parsing error is reported.

Note the same is performed on the trailers.

This patch should patially address the issue #2685. It should be backported
to all stable versions.

(cherry picked from commit 63d2760dfa679bea4b7a61a1a8702af23cf26e75)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/h2.c
src/mux_h2.c