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

Commit 3c7a10d9 authored by Sumedh Sen's avatar Sumedh Sen
Browse files

[RESTRICT AUTOMERGE] Check whether installerPackageName contains only valid characters

Bug: 341256391
Bug: 307532206
Test: sts-tradefed run sts-dynamic-develop -m CtsSecurityTestCases -t android.security.cts.CVE_2024_0044

Change-Id: I74a172c617d6f5b13f0708092156b657b73b5891
parent 0f321a94
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -609,12 +609,17 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
        params.appLabel = TextUtils.trimToSize(params.appLabel,
        params.appLabel = TextUtils.trimToSize(params.appLabel,
                PackageItemInfo.MAX_SAFE_LABEL_LENGTH);
                PackageItemInfo.MAX_SAFE_LABEL_LENGTH);


        // Validate installer package name.
        // Validate requested installer package name.
        if (params.installerPackageName != null && !isValidPackageName(
        if (params.installerPackageName != null && !isValidPackageName(
                params.installerPackageName)) {
                params.installerPackageName)) {
            params.installerPackageName = null;
            params.installerPackageName = null;
        }
        }


        // Validate installer package name.
        if (installerPackageName != null && !isValidPackageName(installerPackageName)) {
            installerPackageName = null;
        }

        String requestedInstallerPackageName =
        String requestedInstallerPackageName =
                params.installerPackageName != null ? params.installerPackageName
                params.installerPackageName != null ? params.installerPackageName
                        : installerPackageName;
                        : installerPackageName;