diff options
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/wifi.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c index fca36f8..cbf8303 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -860,12 +860,14 @@ int wifi_command(const char *ifname, char *command, size_t commandlen, size_t cmdlen = strlen(command) + 1; size_t iflen = strlen(ifname) + IFNAMELEN + 1; - if (commandlen >= cmdlen + iflen) { - memmove((&command[iflen]), command, cmdlen); - snprintf(command, iflen, "%s%s", IFNAME, ifname); - command[iflen - 1] = ' '; - } else { - ALOGE("CmdBuf is too small (%d) for %s", commandlen, command); + if (strncmp(command, IFNAME, IFNAMELEN) != 0) { + if (commandlen >= cmdlen + iflen) { + memmove((&command[iflen]), command, cmdlen); + snprintf(command, iflen, "%s%s", IFNAME, ifname); + command[iflen - 1] = ' '; + } else { + ALOGE("CmdBuf is too small (%d) for %s", commandlen, command); + } } if (is_primary_interface(ifname)) { return wifi_send_command(PRIMARY, command, reply, reply_len); |