Defend against null ApplicationInfos.

Bug: 16303792
Change-Id: Id2d7a70f92718ecda8e3ff418c4e109f6982a75f
This commit is contained in:
Dan Sandler
2014-07-18 14:29:20 -04:00
parent 9f6799becf
commit 09afc2e4ea

View File

@@ -2366,6 +2366,9 @@ public class NotificationManagerService extends SystemService {
try {
ApplicationInfo ai = AppGlobals.getPackageManager().getApplicationInfo(
pkg, 0, UserHandle.getCallingUserId());
if (ai == null) {
throw new SecurityException("Unknown package " + pkg);
}
if (!UserHandle.isSameApp(ai.uid, uid)) {
throw new SecurityException("Calling uid " + uid + " gave package"
+ pkg + " which is owned by uid " + ai.uid);