BUG/MAJOR: quic: reject too large CRYPTO frames
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 20 Jan 2025 09:15:12 +0000 (10:15 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Jan 2025 10:32:57 +0000 (11:32 +0100)
commitf3f6dc86d4880f0e9cb8401118a275e037fc4c1d
tree8182a75a4fb55eeee051f4c23466e45f0f2ac92f
parent0156edf056f5047375c017963d48464bde4de196
BUG/MAJOR: quic: reject too large CRYPTO frames

Received CRYPTO frames are inserted in a ncbuf to handle out-of-order
reception via ncb_add(). They are stored on the position relative to the
frame offset, minus a base offset which corresponds to the in-order data
length already handled.

Previouly, no check was implemented on the frame offset value prior to
ncb_add(), which could easily trigger a crash if relative offset was too
large. Fix this by ensuring first that the frame can be stored in the
buffer before ncb_add() invokation. If this is not the case, connection
is closed with error CRYPTO_BUFFER_EXCEEDED, as required by QUIC
specification.

This should fix github issue #2842.

This must be backported up to 2.6.

(cherry picked from commit c3a4a4d1660866457ffb83699bd091621aae680d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit a43882ff98df536e73fcd3866866e03a933d3f11)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/quic_rx.c