Message ID | 20120913174510.6665938383@ushik.mtv.corp.google.com |
---|---|
State | Superseded |
Headers | show |
On Thu, Sep 13, 2012 at 10:42:14AM -0700, Dmitry Shmidt wrote: > diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c > @@ -3547,6 +3541,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, Thanks! This use of pos in the wpas_p2p_invite() call is just asking for problems, so I fixed this in a bit more robust way (commit 54c61e6e08183472ffe2a07a067b3bd667a6473c) to avoid hitting similar issues in the future if any new uses for pos gets added.
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 848d33d..908e40e 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3525,12 +3525,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 " @@ -3547,6 +3541,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,
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> --- wpa_supplicant/ctrl_iface.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)