1 From 5d4fa2a29bef013e61185beb21a3ec110885eb9a Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <jouni@qca.qualcomm.com>
3 Date: Mon, 6 Oct 2014 18:49:01 +0300
4 Subject: [PATCH 3/3] hostapd_cli: Use os_exec() for action script execution
6 Use os_exec() to run the action script operations to avoid undesired
7 command line processing for control interface event strings. Previously,
8 it could have been possible for some of the event strings to include
9 unsanitized data which is not suitable for system() use. (CVE-2014-3686)
11 Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
13 hostapd/hostapd_cli.c | 25 ++++++++-----------------
14 1 file changed, 8 insertions(+), 17 deletions(-)
16 --- a/hostapd/hostapd_cli.c
17 +++ b/hostapd/hostapd_cli.c
18 @@ -238,28 +238,19 @@ static int hostapd_cli_cmd_mib(struct wp
19 static int hostapd_cli_exec(const char *program, const char *arg1,
28 - len = os_strlen(program) + os_strlen(arg1) + os_strlen(arg2) + 3;
29 - cmd = os_malloc(len);
31 + len = os_strlen(arg1) + os_strlen(arg2) + 2;
32 + arg = os_malloc(len);
35 - res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2);
36 - if (res < 0 || (size_t) res >= len) {
40 - cmd[len - 1] = '\0';
42 - if (system(cmd) < 0)
44 -#endif /* _WIN32_WCE */
46 + os_snprintf(arg, len, "%s %s", arg1, arg2);
47 + res = os_exec(program, arg, 1);