aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2012-07-16 16:15:05 -0700
committerDmitry Shmidt <dimitrysh@google.com>2012-07-16 17:48:44 -0700
commitce1e0634ed741293de60d5ba3476b26ccbd58ce2 (patch)
tree0b754490838be0ac5a6610a9eace840ff238c32b
parent0e6d08e6ec9e3ef3b65a76124d7700d56fe67a8a (diff)
downloadexternal_wpa_supplicant_8-ce1e0634ed741293de60d5ba3476b26ccbd58ce2.zip
external_wpa_supplicant_8-ce1e0634ed741293de60d5ba3476b26ccbd58ce2.tar.gz
external_wpa_supplicant_8-ce1e0634ed741293de60d5ba3476b26ccbd58ce2.tar.bz2
wpa_supplicant: Remove snprintf call from interface= extension
BUG: b/6826116 Change-Id: I35023ce94152a402da94c34083de8ea1387cc758 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--wpa_supplicant/ctrl_iface_unix.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c
index b4af793..301156e 100644
--- a/wpa_supplicant/ctrl_iface_unix.c
+++ b/wpa_supplicant/ctrl_iface_unix.c
@@ -165,33 +165,26 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
reply_len = 2;
} else {
#if defined(CONFIG_P2P) && defined(ANDROID_P2P)
- char *ifname = NULL, *arg;
- char cmd[256];
- /* Skip the command name */
- arg = os_strchr(buf, ' ');
- if (arg) {
- *arg++ = '\0';
- os_strncpy(cmd, buf, sizeof(cmd));
- /* Now search for interface= */
- if (os_strncmp(arg, "interface=", 10) == 0) {
- ifname = arg + 10;
- arg = os_strchr(ifname, ' ');
- if (arg)
- *arg++ = '\0';
- wpa_printf(MSG_DEBUG, "Found interface= in the arg %s ifname %s", arg, ifname);
- for (wpa_s = wpa_s->global->ifaces; wpa_s; wpa_s = wpa_s->next) {
- if (os_strcmp(wpa_s->ifname, ifname) == 0)
- break;
- }
- if (wpa_s == NULL) {
- wpa_printf(MSG_ERROR, "P2P: interface=%s does not exist", ifname);
- wpa_s = eloop_ctx;
- }
+ char *ifname, *ifend;
+
+ ifname = os_strstr(buf, "interface=");
+ if (ifname != NULL) {
+ ifend = os_strchr(ifname + 10, ' ');
+ if (ifend != NULL)
+ *ifend++ = '\0';
+ else
+ ifend = "";
+ 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)
+ break;
+ }
+ if (wpa_s == NULL) {
+ wpa_printf(MSG_ERROR, "P2P: %s does not exist", ifname);
+ wpa_s = eloop_ctx;
}
- if (arg)
- os_snprintf(buf, sizeof(buf), "%s %s", cmd, arg);
+ os_memmove(ifname, ifend, strlen(ifend) + 1);
}
- wpa_printf(MSG_DEBUG, "wpa_s %p cmd %s", wpa_s, buf);
#endif /* defined CONFIG_P2P && defined ANDROID_P2P */
reply = wpa_supplicant_ctrl_iface_process(wpa_s, buf,
&reply_len);