]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix p2p_ctrl_invite_persistent() to parse peer parameter
authorJouni Malinen <j@w1.fi>
Sun, 16 Sep 2012 05:21:46 +0000 (22:21 -0700)
committerJouni Malinen <j@w1.fi>
Sun, 16 Sep 2012 05:21:46 +0000 (22:21 -0700)
Commit 4d32c0c44db43d496f45c5094a9b6ae60c35115e added another use for the
local pos variable and that broke the mechanism used to determine wheter
the peer address was provided. Fix this by using a separate pointer to the
peer address.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/ctrl_iface.c

index 848d33ddded23af5fae7deac4ebc2fed849d7100..51b6fdb1f2a44d9332f9b01e503ba0763a742150 100644 (file)
@@ -3520,7 +3520,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
        char *pos;
        int id;
        struct wpa_ssid *ssid;
-       u8 peer[ETH_ALEN];
+       u8 *_peer = NULL, peer[ETH_ALEN];
        int freq = 0;
        int ht40;
 
@@ -3530,6 +3530,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
                pos += 6;
                if (hwaddr_aton(pos, peer))
                        return -1;
+               _peer = peer;
        }
        ssid = wpa_config_get_network(wpa_s->conf, id);
        if (ssid == NULL || ssid->disabled != 2) {
@@ -3549,8 +3550,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
 
        ht40 = os_strstr(cmd, " ht40") != NULL;
 
-       return wpas_p2p_invite(wpa_s, pos ? peer : NULL, ssid, NULL, freq,
-                              ht40);
+       return wpas_p2p_invite(wpa_s, _peer, ssid, NULL, freq, ht40);
 }