]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: h3: fix uninitialized value in h3_req_headers_send()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 22 Jul 2025 07:39:27 +0000 (09:39 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 22 Jul 2025 07:42:52 +0000 (09:42 +0200)
Due to the introduction of smallbuf usage for HTTP/3 headers emission,
ret variable may be used uninitialized if buffer allocation fails due to
not enough room in QUIC connection window.

Fix this by setting ret value to 0.

Function variable declaration are also adjusted so that the pattern is
similar to h3_resp_headers_send(). Finally, outbuf buffer is also
removed as it is now unused.

No need to backport.

src/h3.c

index 0feee7fa6ab5bd989c19b20598ef250d4486e6cc..e9444c76f0796f1fc944c181fecc6a567d1facf6 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -2002,8 +2002,8 @@ static int h3_encode_header(struct buffer *buf,
  */
 static int h3_req_headers_send(struct qcs *qcs, struct htx *htx)
 {
+       int err;
        struct http_hdr list[global.tune.max_http_hdr * 2];
-       struct buffer outbuf;
        struct buffer headers_buf = BUF_NULL;
        struct buffer *res;
        enum htx_blk_type type;
@@ -2012,7 +2012,8 @@ static int h3_req_headers_send(struct qcs *qcs, struct htx *htx)
        struct ist meth, uri, scheme = IST_NULL, auth = IST_NULL;
        int frame_length_size;  /* size in bytes of frame length varint field */
        int smallbuf = 1;
-       int ret, err, hdr;
+       int ret = 0;
+       int hdr;
 
        TRACE_ENTER(H3_EV_TX_FRAME|H3_EV_TX_HDR, qcs->qcc->conn, qcs);