netd: fix argument interpretation bug
While working around the logwrap() issue, it was replaced with system()
which could lead to various commands getting misinterpreted.
We now use a system() equivalent that doesn't use "sh -c".
Bug:5758556
Change-Id: I2599b526ac34bcfca18d05261286d902d547efda
diff --git a/BandwidthController.cpp b/BandwidthController.cpp
index f0a856e..be3cb28 100644
--- a/BandwidthController.cpp
+++ b/BandwidthController.cpp
@@ -42,6 +42,7 @@
#include <cutils/properties.h>
extern "C" int logwrap(int argc, const char **argv, int background);
+extern "C" int system_nosh(const char *command);
#include "BandwidthController.h"
@@ -185,7 +186,7 @@
fullCmd.insert(0, iptVer == IptIpV4 ? IPTABLES_PATH : IP6TABLES_PATH);
if (!useLogwrapCall) {
- res = system(fullCmd.c_str());
+ res = system_nosh(fullCmd.c_str());
} else {
if (StrncpyAndCheck(buffer, fullCmd.c_str(), sizeof(buffer))) {
LOGE("iptables command too long");