commit | eb818d94a2f1ec3b2e3f56e2122e87bb97b1b1b3 | [log] [tgz] |
---|---|---|
author | Raphael Kim <raphk@google.com> | Mon Oct 09 18:23:14 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Mon Oct 09 18:23:14 2023 +0000 |
tree | 0c41581340c09294b00e4b97cdb80cf6508bd999 | |
parent | af821717bef7f9a3fab840e394e11cd923f800ba [diff] | |
parent | bbeab357de4957b0605f46b1b058bb8a6ca9626a [diff] |
Merge "[CDM] Validate component name length before requesting notification access." into udc-qpr-dev am: bbeab357de Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24805675 Change-Id: I0a5f961b1b2beb5980ec699c4e6f5c94fc6b8d83 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java index df1cf97..34c2548 100644 --- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
@@ -148,6 +148,7 @@ "debug.cdm.cdmservice.removal_time_window"; private static final long ASSOCIATION_REMOVAL_TIME_WINDOW_DEFAULT = DAYS.toMillis(90); + private static final int MAX_CN_LENGTH = 500; private final ActivityManager mActivityManager; private final OnPackageVisibilityChangeListener mOnPackageVisibilityChangeListener; @@ -706,6 +707,9 @@ String callingPackage = component.getPackageName(); checkCanCallNotificationApi(callingPackage); // TODO: check userId. + if (component.flattenToString().length() > MAX_CN_LENGTH) { + throw new IllegalArgumentException("Component name is too long."); + } final long identity = Binder.clearCallingIdentity(); try { return PendingIntent.getActivityAsUser(getContext(),