]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not call wpas_p2p_disconnect_safely() if no match is found
authorJouni Malinen <j@w1.fi>
Mon, 27 Oct 2014 23:47:17 +0000 (01:47 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 27 Oct 2014 23:50:22 +0000 (01:50 +0200)
In theory, wpas_p2p_disconnect_safely() could have dereferenced the
wpa_s == NULL argument, but in practice, it won't due to the
calling_wpa_s == wpa_s check and wpas_p2p_disconnect() accepting NULL.
Anyway, it is cleaner to add an explicit check for this. (CID 74492)

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/p2p_supplicant.c

index 0e43614443e48f0bf550ab01b2504e985a5f7012..2712bb3d447fceb03dc9c0b97841857e32b7d56b 100644 (file)
@@ -455,7 +455,7 @@ static void run_wpas_p2p_disconnect(void *eloop_ctx, void *timeout_ctx)
 static int wpas_p2p_disconnect_safely(struct wpa_supplicant *wpa_s,
                                      struct wpa_supplicant *calling_wpa_s)
 {
-       if (calling_wpa_s == wpa_s &&
+       if (calling_wpa_s == wpa_s && wpa_s &&
            wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
                /*
                 * The calling wpa_s instance is going to be removed. Do that