Address SessionCommitReceiver vulnerability by validating intent.
Bug: 144081762 Change-Id: I28699d26abefc716e57c281c15699f15003229b2
This commit is contained in:
parent
f788bbb0c4
commit
7e04887e59
|
@ -71,8 +71,13 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
SessionInfo info = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
|
SessionInfo info = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
|
||||||
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
|
UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
|
||||||
PackageInstallerCompat packageInstallerCompat = PackageInstallerCompat.getInstance(context);
|
if (!PackageInstaller.ACTION_SESSION_COMMITTED.equals(intent.getAction())
|
||||||
|
|| info == null || user == null) {
|
||||||
|
// Invalid intent.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PackageInstallerCompat packageInstallerCompat = PackageInstallerCompat.getInstance(context);
|
||||||
if (TextUtils.isEmpty(info.getAppPackageName())
|
if (TextUtils.isEmpty(info.getAppPackageName())
|
||||||
|| info.getInstallReason() != PackageManager.INSTALL_REASON_USER
|
|| info.getInstallReason() != PackageManager.INSTALL_REASON_USER
|
||||||
|| packageInstallerCompat.promiseIconAddedForId(info.getSessionId())) {
|
|| packageInstallerCompat.promiseIconAddedForId(info.getSessionId())) {
|
||||||
|
|
Loading…
Reference in New Issue