Skip to content

Commit 1175720

Browse files
William LeshnerAndroid Build Coastguard Worker
authored andcommitted
Fix vulnerability that allowed attackers to start arbitary activities
Test: Flashed device and verified dream settings works as expected Test: Installed APK from bug and verified the dream didn't allow launching the inappropriate settings activity. Fixes: 300090204 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bf8ff047eb25960720a688cb16aa44b3775799da) Merged-In: I146415ad400827d0a798e27f34f098feb5e96422 Change-Id: I146415ad400827d0a798e27f34f098feb5e96422
1 parent 3fdf954 commit 1175720

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

core/java/android/service/dreams/DreamService.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,17 @@ private static ComponentName convertToComponentName(String flattenedString,
11921192
if (!flattenedString.contains("/")) {
11931193
return new ComponentName(serviceInfo.packageName, flattenedString);
11941194
}
1195-
1196-
return ComponentName.unflattenFromString(flattenedString);
1195+
// Ensure that the component is from the same package as the dream service. If not,
1196+
// treat the component as invalid and return null instead.
1197+
final ComponentName cn = ComponentName.unflattenFromString(flattenedString);
1198+
if (cn == null) return null;
1199+
if (!cn.getPackageName().equals(serviceInfo.packageName)) {
1200+
Log.w(TAG,
1201+
"Inconsistent package name in component: " + cn.getPackageName()
1202+
+ ", should be: " + serviceInfo.packageName);
1203+
return null;
1204+
}
1205+
return cn;
11971206
}
11981207

11991208
/**

0 commit comments

Comments
 (0)