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

Commit 5862c5f8 authored by Christopher Desjardins's avatar Christopher Desjardins Committed by Wale Ogunwale
Browse files

Fix null pointer dereference when security exception occurs

Just above the SecurityException is a check for r.record == null,
thus dereferencing r.record will cause a null pointer exception.

Found in Android 4.3 with the following steps:

1) Start the music app.
2) Switch to the restricted user.
3) Navigate to Settings->Apps->Running->Music.
4) Tap the stop button.

The security exception should be thrown which results in
a nice message to the user, but instead a null pointer
exception is thrown which results in the settings app
crashing.

Change-Id: I4a306c38650c9d366896e592767dde70adb71c57
parent 55b4b2d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -518,7 +518,7 @@ public final class ActiveServices {
            // r.record is null if findServiceLocked() failed the caller permission check
            // r.record is null if findServiceLocked() failed the caller permission check
            if (r.record == null) {
            if (r.record == null) {
                throw new SecurityException(
                throw new SecurityException(
                        "Permission Denial: Accessing service " + r.record.name
                        "Permission Denial: Accessing service"
                        + " from pid=" + Binder.getCallingPid()
                        + " from pid=" + Binder.getCallingPid()
                        + ", uid=" + Binder.getCallingUid()
                        + ", uid=" + Binder.getCallingUid()
                        + " requires " + r.permission);
                        + " requires " + r.permission);