diff options
| author | 2023-04-05 15:15:41 +0000 | |
|---|---|---|
| committer | 2023-04-26 11:15:47 +0100 | |
| commit | 3d8400f5e407c9a00086c334a17e706845b42528 (patch) | |
| tree | 7db7e8f7c31b8b7a4842c519f874f864874a8f90 /libs/androidfw/StringPool.cpp | |
| parent | 1e9f13da3435d754456c5674a8b6b1fedcb6dc11 (diff) | |
Ensure policy has no absurdly long strings
The following APIs now enforce limits and throw IllegalArgumentException
when limits are violated:
* DPM.setTrustAgentConfiguration() limits agent packgage name,
component name, and strings within configuration bundle.
* DPM.setPermittedAccessibilityServices() limits package names.
* DPM.setPermittedInputMethods() limits package names.
* DPM.setAccountManagementDisabled() limits account name.
* DPM.setLockTaskPackages() limits package names.
* DPM.setAffiliationIds() limits id.
* DPM.transferOwnership() limits strings inside the bundle.
Package names are limited at 223, because they become directory names
and it is a filesystem restriction, see FrameworkParsingPackageUtils.
All other strings are limited at 65535, because longer ones break binary
XML serializer.
The following APIs silently truncate strings that are long beyond reason:
* DPM.setShortSupportMessage() truncates message at 200.
* DPM.setLongSupportMessage() truncates message at 20000.
* DPM.setOrganizationName() truncates org name at 200.
Bug: 260729089
Test: btest a.d.c.KeyguardTest
Test: btest a.d.c.SupportMessageTest
Test: btest a.d.c.PermitInputMethodsTest
Test: btest a.d.c.AccountManagementTest
Test: btest a.d.c.AffiliationIdsTest
Test: atest com.android.server.devicepolicy
Change-Id: Idcf54e408722f164d16bf2f24a00cd1f5b626d23
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions