Blame SOURCES/0002-wpa_cli-Use-os_exec-for-action-script-execution.patch

250fd0
From c5f258de76dbb67fb64beab39a99e5c5711f41fe Mon Sep 17 00:00:00 2001
250fd0
From: Jouni Malinen <jouni@qca.qualcomm.com>
250fd0
Date: Mon, 6 Oct 2014 17:25:52 +0300
250fd0
Subject: [PATCH 2/2] wpa_cli: Use os_exec() for action script execution
250fd0
250fd0
Use os_exec() to run the action script operations to avoid undesired
250fd0
command line processing for control interface event strings. Previously,
250fd0
it could have been possible for some of the event strings to include
250fd0
unsanitized data which is not suitable for system() use. (CVE-2014-3686)
250fd0
250fd0
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
250fd0
---
250fd0
 wpa_supplicant/wpa_cli.c | 25 ++++++++-----------------
250fd0
 1 file changed, 8 insertions(+), 17 deletions(-)
250fd0
250fd0
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
250fd0
index 18b9b77..fe30b41 100644
250fd0
--- a/wpa_supplicant/wpa_cli.c
250fd0
+++ b/wpa_supplicant/wpa_cli.c
250fd0
@@ -3155,36 +3155,27 @@ static int str_match(const char *a, const char *b)
250fd0
 	return os_strncmp(a, b, os_strlen(b)) == 0;
250fd0
 }
250fd0
 
250fd0
 
250fd0
 static int wpa_cli_exec(const char *program, const char *arg1,
250fd0
 			const char *arg2)
250fd0
 {
250fd0
-	char *cmd;
250fd0
+	char *arg;
250fd0
 	size_t len;
250fd0
 	int res;
250fd0
-	int ret = 0;
250fd0
 
250fd0
-	len = os_strlen(program) + os_strlen(arg1) + os_strlen(arg2) + 3;
250fd0
-	cmd = os_malloc(len);
250fd0
-	if (cmd == NULL)
250fd0
+	len = os_strlen(arg1) + os_strlen(arg2) + 2;
250fd0
+	arg = os_malloc(len);
250fd0
+	if (arg == NULL)
250fd0
 		return -1;
250fd0
-	res = os_snprintf(cmd, len, "%s %s %s", program, arg1, arg2);
250fd0
-	if (res < 0 || (size_t) res >= len) {
250fd0
-		os_free(cmd);
250fd0
-		return -1;
250fd0
-	}
250fd0
-	cmd[len - 1] = '\0';
250fd0
-#ifndef _WIN32_WCE
250fd0
-	if (system(cmd) < 0)
250fd0
-		ret = -1;
250fd0
-#endif /* _WIN32_WCE */
250fd0
-	os_free(cmd);
250fd0
+	os_snprintf(arg, len, "%s %s", arg1, arg2);
250fd0
+	res = os_exec(program, arg, 1);
250fd0
+	os_free(arg);
250fd0
 
250fd0
-	return ret;
250fd0
+	return res;
250fd0
 }
250fd0
 
250fd0
 
250fd0
 static void wpa_cli_action_process(const char *msg)
250fd0
 {
250fd0
 	const char *pos;
250fd0
 	char *copy = NULL, *id, *pos2;
250fd0
-- 
250fd0
1.9.3
250fd0