diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2012-09-13 10:39:48 -0700 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2012-09-13 10:39:48 -0700 |
commit | 07f427a83c1bd048f8c4b6515d45f81e96877e37 (patch) | |
tree | c91b6eaf3839a25aa6cc553d5efe2695509b3a07 | |
parent | f4f5db315918f3f048324ea43dc37a3b0fb31ecc (diff) | |
download | external_wpa_supplicant_8-07f427a83c1bd048f8c4b6515d45f81e96877e37.zip external_wpa_supplicant_8-07f427a83c1bd048f8c4b6515d45f81e96877e37.tar.gz external_wpa_supplicant_8-07f427a83c1bd048f8c4b6515d45f81e96877e37.tar.bz2 |
wpa_supplicant: Fix P2P command processing
Change-Id: Ib2e811513be7b05178e310040f7cae14cb425421
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r-- | wpa_supplicant/ctrl_iface.c | 13 | ||||
-rw-r--r-- | wpa_supplicant/ctrl_iface_unix.c | 7 |
2 files changed, 11 insertions, 9 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 480c077..0d8821b 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3552,12 +3552,6 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd) int ht40; id = atoi(cmd); - pos = os_strstr(cmd, " peer="); - if (pos) { - pos += 6; - if (hwaddr_aton(pos, peer)) - return -1; - } ssid = wpa_config_get_network(wpa_s->conf, id); if (ssid == NULL || ssid->disabled != 2) { wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find SSID id=%d " @@ -3574,6 +3568,13 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd) return -1; } + pos = os_strstr(cmd, " peer="); + if (pos) { + pos += 6; + if (hwaddr_aton(pos, peer)) + return -1; + } + ht40 = os_strstr(cmd, " ht40") != NULL; return wpas_p2p_invite(wpa_s, pos ? peer : NULL, ssid, NULL, freq, diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c index 5d81b43..80db27e 100644 --- a/wpa_supplicant/ctrl_iface_unix.c +++ b/wpa_supplicant/ctrl_iface_unix.c @@ -175,7 +175,7 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx, if (ifend != NULL) *ifend++ = '\0'; else - ifend = ""; + *(ifname - 1) = '\0'; wpa_printf(MSG_DEBUG, "Found %s", ifname); for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) { if (os_strcmp(wpa_s->ifname, ifname + 10) == 0) @@ -185,8 +185,9 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx, wpa_printf(MSG_ERROR, "P2P: %s does not exist", ifname); wpa_s = eloop_ctx; } - os_memmove(ifname, ifend, strlen(ifend) + 1); - wpa_printf(MSG_INFO, "wpa_s %p cmd %s", wpa_s, buf); + if (ifend != NULL) + os_memmove(ifname, ifend, strlen(ifend) + 1); + wpa_printf(MSG_INFO, "wpa_s->ifname %s cmd %s", wpa_s ? wpa_s->ifname : "NULL", buf); } #endif /* defined CONFIG_P2P && defined ANDROID_P2P */ reply = wpa_supplicant_ctrl_iface_process(wpa_s, buf, |