]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
MLD STA: Fully clear MLO info to avoid use of uninitialized members
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 2 Nov 2022 09:56:46 +0000 (11:56 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 2 Nov 2022 09:56:46 +0000 (11:56 +0200)
The initial wpa_drv_get_mlo_info() implementation cleared only the
valid_links information within struct driver_sta_mlo_info before trying
to fetch the information from the driver. While this is likely going to
work fine in practice, this can result in static analyzer warnings on
use of uninitialized memory (e.g., mlo.assoc_link_id could have been
read if wpa_s->valid_links was set to a nonzero value). In any case, it
is better to avoid such unnecessary warnings by clearing the full data
structure before using it.

Fixes: 7784964cbe88 ("MLD STA: Fetch MLO connection info into core wpa_supplicant")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/events.c

index f277e2163e9f6b682e413cee2938581c753824b9..89e0b09ea784fecd4ee45422151794b52dba9fff 100644 (file)
@@ -3360,7 +3360,7 @@ static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s)
        struct driver_sta_mlo_info mlo;
        int i;
 
-       mlo.valid_links = 0;
+       os_memset(&mlo, 0, sizeof(mlo));
        if (wpas_drv_get_sta_mlo_info(wpa_s, &mlo)) {
                wpa_dbg(wpa_s, MSG_ERROR, "Failed to get MLO link info");
                wpa_supplicant_deauthenticate(wpa_s,