]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Missing transport parameters initializations
authorFrédéric Lécaille <flecaille@haproxy.com>
Sat, 17 Jun 2023 11:23:16 +0000 (13:23 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Mon, 19 Jun 2023 06:49:04 +0000 (08:49 +0200)
This bug was introduced by this commit:

     MINOR: quic: Remove pool_zalloc() from qc_new_conn()

The transport parameters was not initialized. This leaded to a crash when
dumping the received ones from TRACE()s.

Also reset the lengths of the CIDs attached to a quic_conn struct to 0 value
to prevent them from being dumped from traces when not already initialized.

No backport needed.

src/quic_conn.c

index 29d229edd7117b65d2336b99b2b38488b9417f22..ecf30e6daa468d743c1b171479c7946fdce99c77 100644 (file)
@@ -5542,6 +5542,8 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
 
        /* Initialize in priority qc members required for a safe dealloc. */
 
+       /* Prevents these CID to be dumped by TRACE() calls */
+       qc->scid.len = qc->odcid.len = qc->dcid.len = 0;
        /* required to use MTLIST_IN_LIST */
        MT_LIST_INIT(&qc->accept_list);
 
@@ -5688,9 +5690,11 @@ static struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
        qc->tx.nb_buf = QUIC_CONN_TX_BUFS_NB;
        qc->tx.wbuf = qc->tx.rbuf = 0;
        qc->tx.bytes = qc->tx.prep_bytes = 0;
+       memset(&qc->tx.params, 0, sizeof(qc->tx.params));
        qc->tx.buf = BUF_NULL;
        /* RX part. */
        qc->rx.bytes = 0;
+       memset(&qc->rx.params, 0, sizeof(qc->rx.params));
        qc->rx.buf = b_make(qc->rx.buf.area, QUIC_CONN_RX_BUFSZ, 0, 0);
        for (i = 0; i < QCS_MAX_TYPES; i++)
                qc->rx.strms[i].nb_streams = 0;