]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: xprt_qstrm: do not parse record length on read again
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 13 Apr 2026 06:47:01 +0000 (08:47 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 13 Apr 2026 07:11:08 +0000 (09:11 +0200)
conn_recv_qstrm() may be called several times per connection if the read
data is too short and a truncated record is received.

Previously, record length was parsed every time the function is invoked.
However, this must only be performed if record length varint is
incomplete. Once read and parsed, data are removed from the buffer via
b_quic_dec_int(). Thus, next conn_recv_qstrm() run will reread an
invalid record length this time.

This patch fixes this by only parsing record length if <rxrlen> member
is null. Prior to it, parsing of QMux transport parameters would fail in
case of a first truncated read, which would prevent the connection
initialization.

No need to backport.

src/xprt_qstrm.c

index 38f527d4874c7af40f0503ff3c84cea695adac04..2c5b147f0ac8eafa8602c8adf77181cdd2f3e17c 100644 (file)
@@ -81,7 +81,7 @@ int conn_recv_qstrm(struct connection *conn, struct xprt_qstrm_ctx *ctx, int fla
                goto not_ready;
 
        /* Read record length. */
-       if (!b_quic_dec_int(&ctx->rxrlen, buf, NULL))
+       if (!ctx->rxrlen && !b_quic_dec_int(&ctx->rxrlen, buf, NULL))
                goto not_ready;
 
        /* Reject too small or too big records. */