Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c232f5a authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Escape arguments before passing to netd.

Change-Id: I70bb0cb1e90abd490f8893365c6bdf1844b01d18
parent ea2f8029
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -1471,9 +1471,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
    public void setDnsInterfaceForPid(String iface, int pid) throws IllegalStateException {
    public void setDnsInterfaceForPid(String iface, int pid) throws IllegalStateException {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
        try {
            String cmd = "resolver setifaceforpid " + iface + " " + pid;
            mConnector.execute("resolver", "setifaceforpid", iface, pid);

            mConnector.execute(cmd);
        } catch (NativeDaemonConnectorException e) {
        } catch (NativeDaemonConnectorException e) {
            throw new IllegalStateException(
            throw new IllegalStateException(
                    "Error communicating with native deamon to set interface for pid" + iface, e);
                    "Error communicating with native deamon to set interface for pid" + iface, e);
@@ -1484,9 +1482,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
    public void clearDnsInterfaceForPid(int pid) throws IllegalStateException {
    public void clearDnsInterfaceForPid(int pid) throws IllegalStateException {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
        try {
            String cmd = "resolver clearifaceforpid " + pid;
            mConnector.execute("resolver", "clearifaceforpid", pid);

            mConnector.execute(cmd);
        } catch (NativeDaemonConnectorException e) {
        } catch (NativeDaemonConnectorException e) {
            throw new IllegalStateException(
            throw new IllegalStateException(
                    "Error communicating with native deamon to clear interface for pid " + pid, e);
                    "Error communicating with native deamon to clear interface for pid " + pid, e);