diff options
| author | Jouni Malinen <jouni@qca.qualcomm.com> | 2014-10-07 10:29:35 -0700 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2014-10-07 10:29:35 -0700 |
| commit | 772e12cfed81754a9fd890be7bc77bc602a549b5 (patch) | |
| tree | 913a7e255572d9c58075fc460f96b3ef43e369d0 /hostapd | |
| parent | 376e1c49a92868fb0f2785ff01da2f5954341474 (diff) | |
| download | android_external_wpa_supplicant_8-772e12cfed81754a9fd890be7bc77bc602a549b5.tar.gz android_external_wpa_supplicant_8-772e12cfed81754a9fd890be7bc77bc602a549b5.tar.bz2 android_external_wpa_supplicant_8-772e12cfed81754a9fd890be7bc77bc602a549b5.zip | |
Cumulative security CVE-2014-3686 patch
0cf0fcc Add os_exec() helper to run external programs
12b6e6a wpa_cli: Use os_exec() for action script execution
515fa39 hostapd_cli: Use more robust mechanism for action script execution
Bug: 17880188
Change-Id: I0c6162f5339b1f3d8d2cc59203b919455abd592b
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'hostapd')
| -rw-r--r-- | hostapd/hostapd_cli.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index 1c4a84c6..95f28d33 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -238,28 +238,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; } |
