Revise the IllegalArgumentException check

Combining the two IllegalArgumentException check to mitigate the
potential information leakage.

Bug: 189858128
Test: atest ApplicationInfoTest
Test: manually using the PoC in the buganizer to ensure the symptom
      no longer exists.
Change-Id: Ice6d90e2961bf58896c603df78b1493761f42ff0
This commit is contained in:
Jackal Guo
2021-06-15 11:01:30 +08:00
parent 96d2926fc7
commit 792e2bc9b5

View File

@@ -17097,10 +17097,7 @@ public class PackageManagerService extends IPackageManager.Stub
callerPackageName);
synchronized (mLock) {
PackageSetting ps = mSettings.getPackageLPr(packageName);
if (ps == null) {
throw new IllegalArgumentException("Unknown target package " + packageName);
}
if (shouldFilterApplicationLocked(
if (ps == null || shouldFilterApplicationLocked(
ps, Binder.getCallingUid(), UserHandle.getCallingUserId())) {
throw new IllegalArgumentException("Unknown target package " + packageName);
}