]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Wrong Initial packet connection initialization
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 15 Nov 2021 15:21:40 +0000 (16:21 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Fri, 19 Nov 2021 13:37:35 +0000 (14:37 +0100)
->qc (QUIC connection) member of packet structure were badly initialized
when received as second Initial packet (from picoquic -Q for instance).
This leaded to corrupt the quic_conn structure with random behaviors
as size effects. This bug came with this commit:
   "MINOR: quic: Possible wrong connection identification"

src/xprt_quic.c

index a5740dbcb6b8fc7a52b263353a27a79ba40adaa9..d4511609dcea92221ee9ed5fbc5f36d2058b1de0 100644 (file)
@@ -3759,9 +3759,9 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
                        }
                        HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &l->rx.cids_lock);
 
-                       pkt->qc = qc;
                        if (n == &qc->odcid_node) {
                                /* Enqueue this packet. */
+                               pkt->qc = qc;
                                MT_LIST_APPEND(&l->rx.pkts, &pkt->rx_list);
                                /* Try to accept a new connection. */
                                listener_accept(l);
@@ -3769,6 +3769,7 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
                        else {
                                quic_conn_free(qc);
                                qc = ebmb_entry(n, struct quic_conn, odcid_node);
+                               pkt->qc = qc;
                        }
 
                        /* This is the DCID node sent in this packet by the client. */