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

Commit 3ef59228 authored by Kunal Malhotra's avatar Kunal Malhotra Committed by Android (Google) Code Review
Browse files

Merge "Adding in verification of calling UID in onShellCommand"

parents 15e1c62b b651d295
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -9681,6 +9681,10 @@ public class ActivityManagerService extends IActivityManager.Stub
    public void onShellCommand(FileDescriptor in, FileDescriptor out,
    public void onShellCommand(FileDescriptor in, FileDescriptor out,
            FileDescriptor err, String[] args, ShellCallback callback,
            FileDescriptor err, String[] args, ShellCallback callback,
            ResultReceiver resultReceiver) {
            ResultReceiver resultReceiver) {
        final int callingUid = Binder.getCallingUid();
        if (callingUid != ROOT_UID && callingUid != Process.SHELL_UID) {
            throw new SecurityException("Shell commands are only callable by root or shell");
        }
        (new ActivityManagerShellCommand(this, false)).exec(
        (new ActivityManagerShellCommand(this, false)).exec(
                this, in, out, err, args, callback, resultReceiver);
                this, in, out, err, args, callback, resultReceiver);
    }
    }