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/NatController.cpp b/NatController.cpp
index 5f6a46a..ed1b095 100644
--- a/NatController.cpp
+++ b/NatController.cpp
@@ -30,7 +30,7 @@
#include "NatController.h"
#include "SecondaryTableController.h"
-extern "C" int logwrap(int argc, const char **argv, int background);
+extern "C" int system_nosh(const char *command);
static char IPTABLES_PATH[] = "/system/bin/iptables";
static char IP_PATH[] = "/system/bin/ip";
@@ -55,7 +55,7 @@
}
asprintf(&buffer, "%s %s", path, cmd);
- res = system(buffer);
+ res = system_nosh(buffer);
free(buffer);
return res;
}