summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorRobin Lee <rgl@google.com>2014-02-20 12:50:41 +0000
committerRobin Lee <rgl@google.com>2014-02-20 13:39:10 +0000
commit08fc72d0317fd39a6fa0b2d47c6a5b1529309629 (patch)
treed6b360352ecfb22566cedc0a96468a464df527bd /services/devicepolicy
parentc4f6c351e18380e712d5d365d2a13cfa5674daf7 (diff)
downloadframeworks_base-08fc72d0317fd39a6fa0b2d47c6a5b1529309629.zip
frameworks_base-08fc72d0317fd39a6fa0b2d47c6a5b1529309629.tar.gz
frameworks_base-08fc72d0317fd39a6fa0b2d47c6a5b1529309629.tar.bz2
Check DeviceOwner exists before using packageName
Creating a profile owner when there is no device owner present also creates a new DeviceOwner object without packageName set -- this situation can lead to a null pointer access when calling isDeviceOwner. Change-Id: I31eab498d78cadc67a1aedd205b458dee2d27705
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 12f0114..f9a5e5d 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -1315,9 +1315,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
if (admin.getUid() != Binder.getCallingUid()) {
// If trying to remove device owner, refuse when the caller is not the owner.
- if (mDeviceOwner != null
- && adminReceiver.getPackageName().equals(
- mDeviceOwner.getDeviceOwnerPackageName())) {
+ if (isDeviceOwner(adminReceiver.getPackageName())) {
return;
}
mContext.enforceCallingOrSelfPermission(
@@ -2793,6 +2791,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
synchronized (this) {
return mDeviceOwner != null
+ && mDeviceOwner.hasDeviceOwner()
&& mDeviceOwner.getDeviceOwnerPackageName().equals(packageName);
}
}