aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2014-10-06 18:49:01 +0300
committerDan Pasanen <dan.pasanen@gmail.com>2014-10-09 15:01:50 -0500
commitb76a82e8f28a5c3f43958e0e1b3c26390725b040 (patch)
tree1555bd5a2c962008359b0def06c2a2d0eb9ce917
parent8e575d91534fd8ad98b06caec872a056c7f2737c (diff)
downloadandroid_external_wpa_supplicant_8-b76a82e8f28a5c3f43958e0e1b3c26390725b040.tar.gz
android_external_wpa_supplicant_8-b76a82e8f28a5c3f43958e0e1b3c26390725b040.tar.bz2
android_external_wpa_supplicant_8-b76a82e8f28a5c3f43958e0e1b3c26390725b040.zip
hostapd_cli: Use os_exec() for action script execution
Use os_exec() to run the action script operations to avoid undesired command line processing for control interface event strings. Previously, it could have been possible for some of the event strings to include unsanitized data which is not suitable for system() use. (CVE-2014-3686) Change-Id: If46d6cfcb9d7fc9700965e818315e5aa50fa11a5 Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r--hostapd/hostapd_cli.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 7187abcf..4d73481e 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -225,28 +225,19 @@ static int hostapd_cli_cmd_mib(struct wpa_ctrl *ctrl, int argc, char *argv[])
static int hostapd_cli_exec(const char *program, const char *arg1,
const char *arg2)
{
- char *cmd;
+ char *arg;
size_t len;
int res;
- int ret = 0;
- len = os_strlen(program) + os_strlen(arg1) + os_strlen(arg2) + 3;
- cmd = os_malloc(len);
- if (cmd == NULL)
+ len = os_strlen(arg1) + os_strlen(arg2) + 2;
+ arg = os_malloc(len);
+ if (arg == NULL)
return -1;
- res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2);
- if (res < 0 || (size_t) res >= len) {
- os_free(cmd);
- return -1;
- }
- cmd[len - 1] = '\0';
-#ifndef _WIN32_WCE
- if (system(cmd) < 0)
- ret = -1;
-#endif /* _WIN32_WCE */
- os_free(cmd);
+ os_snprintf(arg, len, "%s %s", arg1, arg2);
+ res = os_exec(program, arg, 1);
+ os_free(arg);
- return ret;
+ return res;
}