]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: quic: Possible use of uninitialized <odcid> variable in qc_lstnr_params_i...
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 11 Aug 2022 15:24:38 +0000 (17:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Aug 2022 16:33:36 +0000 (18:33 +0200)
commite9325e97c2b0a6c16fc39e4d231506b9f407d741
treed5d28d93f1aec563b840721b34ae920f87cfb3b5
parent6bdf9367fbf2ea51fce693d8013cb46de8af2df0
BUG/MEDIUM: quic: Possible use of uninitialized <odcid> variable in qc_lstnr_params_init()

When receiving a token into a client Initial packet without a cluster secret defined
by configuration, the <odcid> variable used to parse the ODCID from the token
could be used without having been initialized. Such a packet must be dropped. So
the sufficient part of this patch is this check:

+             }
+             else if (!global.cluster_secret && token_len) {
+                    /* Impossible case: a token was received without configured
+                    * cluster secret.
+                    */
+                    TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT,
+                    NULL, NULL, NULL, qv);
+                    goto drop;
              }

Take the opportunity of this patch to rework and make it more readable this part
of code where such a packet must be dropped removing the <check_token> variable.
When an ODCID is parsed from a token, new <token_odcid> new pointer variable
is set to the address of the parsed ODCID. This way, is not set but used it will
make crash haproxy. This was not always the case with an uninitialized local
variable.

Adapt the API to used such a pointer variable: <token> boolean variable is removed
from qc_lstnr_params_init() prototype.

This must be backported to 2.6.
include/haproxy/quic_tp.h
src/quic_tp.c
src/xprt_quic.c