]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Avoid starting the mux if no ALPN sent by the client
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 13 Apr 2022 14:20:09 +0000 (16:20 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 13 Apr 2022 14:48:43 +0000 (16:48 +0200)
If the client does not sent an ALPN, the SSL ALPN negotiation callback
is not called. However, the handshake is reported as successful. Check
just after SSL_do_handshake if an ALPN was negotiated. If not, emit a
CONNECTION_CLOSE with a TLS alert to close the connection.

This prevent a crash in qcc_install_app_ops() called with null as second
parameter value.

src/xprt_quic.c

index 2726a276f1585904142b3bdf5ab20c586fdd229d..6ab18d87110d6fd07d294b7b175f825b3d2d7fbc 100644 (file)
@@ -2068,6 +2068,14 @@ static inline int qc_provide_cdata(struct quic_enc_level *el,
                }
 
                TRACE_PROTO("SSL handshake OK", QUIC_EV_CONN_IO_CB, qc, &state);
+
+               /* Check the alpn could be negotiated */
+               if (!qc->app_ops) {
+                       TRACE_PROTO("No ALPN", QUIC_EV_CONN_IO_CB, qc, &state);
+                       quic_set_tls_alert(qc, SSL_AD_NO_APPLICATION_PROTOCOL);
+                       goto err;
+               }
+
                /* I/O callback switch */
                ctx->wait_event.tasklet->process = quic_conn_app_io_cb;
                if (qc_is_listener(ctx->qc)) {