]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: unchecked qc_retrieve_conn_from_cid() returned value
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 21 Dec 2021 13:48:58 +0000 (14:48 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Wed, 22 Dec 2021 16:27:51 +0000 (17:27 +0100)
If qc_retrieve_conn_from_cid() did not manage to retrieve the connection
from packet CIDs, we must drop them.

src/xprt_quic.c

index ee609753f2d702ecd926e8a830f9c817aa79b108..e87124412c019ff9ca583e5c7d237bc814f939bb 100644 (file)
@@ -4117,6 +4117,12 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
                *buf += QUIC_HAP_CID_LEN;
 
                qc = qc_retrieve_conn_from_cid(pkt, l, saddr);
+               if (!qc) {
+                       size_t pktlen = end - *buf;
+                       TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT, NULL, pkt, &pktlen);
+                       goto err;
+               }
+
                if (HA_ATOMIC_LOAD(&qc->conn))
                        conn_ctx = HA_ATOMIC_LOAD(&qc->conn->xprt_ctx);