]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic/ssl: crash in ClientHello callback ssl traces
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 27 Nov 2025 10:22:46 +0000 (11:22 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 8 Dec 2025 09:40:59 +0000 (10:40 +0100)
Such crashes may occur for QUIC frontends only when the SSL traces are enabled.

ssl_sock_switchctx_cbk() ClientHello callback may be called without any connection
initialize (<conn>) for QUIC connections leading to crashes when passing
conn->err_code to TRACE_ERROR().

Modify the TRACE_ERROR() statement to pass this parameter only when <conn> is
initialized.

Must be backported as far as 3.2.

src/ssl_clienthello.c

index ffc06b94b2d96380ac1f2eb22e5904646ff13dae..af4b1d9ffd507c95d78e384c70a03f6070f3d680 100644 (file)
@@ -506,7 +506,8 @@ sni_lookup:
        /* abort handshake (was SSL_TLSEXT_ERR_ALERT_FATAL) */
        if (conn)
                conn->err_code = CO_ER_SSL_HANDSHAKE;
-       TRACE_ERROR("No suitable SSL context found", SSL_EV_CONN_SWITCHCTX_CB|SSL_EV_CONN_ERR, conn, ssl, &conn->err_code);
+       TRACE_ERROR("No suitable SSL context found", SSL_EV_CONN_SWITCHCTX_CB|SSL_EV_CONN_ERR,
+                   conn, ssl, conn ? &conn->err_code : NULL);
 #if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC)
        return ssl_select_cert_error;
 #else