BUG/MINOR: quic: fix segfault on trace for version negotiation
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 18 Nov 2021 13:38:00 +0000 (14:38 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 19 Nov 2021 14:10:44 +0000 (15:10 +0100)
When receiving Initial packets for Version Negotiation, no quic_conn is
instantiated. Thus, on the final trace, the quic_conn dereferencement
must be tested before using it.

src/xprt_quic.c

index d1e24ba..a132082 100644 (file)
@@ -3874,7 +3874,7 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
        if (conn_ctx && HA_ATOMIC_LOAD(&conn_ctx->conn->ctx))
                tasklet_wakeup(conn_ctx->wait_event.tasklet);
 
-       TRACE_LEAVE(QUIC_EV_CONN_LPKT, qc->conn, pkt);
+       TRACE_LEAVE(QUIC_EV_CONN_LPKT, qc ? qc->conn : NULL, pkt);
 
        return pkt->len;