]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add missing NULL check in p2p_ctrl_flush()
authorDan Callaghan <dan.callaghan@morsemicro.com>
Mon, 10 Nov 2025 03:08:02 +0000 (14:08 +1100)
committerJouni Malinen <j@w1.fi>
Sat, 24 Jan 2026 17:51:13 +0000 (19:51 +0200)
When wpa_supplicant is compiled with CONFIG_TESTING_OPTIONS and receives
a FLUSH command from wpa_cli, p2p_ctrl_flush() may crash due to passing
a NULL pointer into p2p_set_invitation_op_freq().

Add a NULL pointer check, similar to the other NULL pointer check
already in p2p_ctrl_flush().

Fixes: 475f50d71001 ("P2P2: Allow op class and channel override for Invitation Response")
Signed-off-by: Dan Callaghan <dan.callaghan@morsemicro.com>
wpa_supplicant/ctrl_iface.c

index 4426d45f69ddd647796c93c3abfa63b2523eb0ae..92ab86fc06e8171150e6a25ad9488ed101dcdad3 100644 (file)
@@ -7922,7 +7922,8 @@ static void p2p_ctrl_flush(struct wpa_supplicant *wpa_s)
 #ifdef CONFIG_TESTING_OPTIONS
        os_free(wpa_s->get_pref_freq_list_override);
        wpa_s->get_pref_freq_list_override = NULL;
-       p2p_set_invitation_op_freq(wpa_s->global->p2p, -1);
+       if (wpa_s->global->p2p)
+               p2p_set_invitation_op_freq(wpa_s->global->p2p, -1);
 #endif /* CONFIG_TESTING_OPTIONS */
 
        wpas_p2p_stop_find(wpa_s);