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

Commit cb890336 authored by Evan Chen's avatar Evan Chen Committed by Android Build Coastguard Worker
Browse files

Fix Security issue for Html.fromHtml without escape

Add Html.escapeHtml() for the string and also remove profileName
for the confirmation_title to make sure the confirmation_title always
show the device's name.

Bug: 172251622
Bug: 197035186
Test: Manual
Change-Id: I7e2f95fd85e18127dc481f188ace8ad6effc4831
(cherry picked from commit 8f005ffe)
parent 3f7e5e44
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -93,9 +93,9 @@ public class CompanionDeviceActivity extends Activity {
            final DeviceFilterPair selectedDevice = getService().mDevicesFound.get(0);
            setTitle(Html.fromHtml(getString(
                    R.string.confirmation_title,
                    getCallingAppName(),
                    profileName,
                    selectedDevice.getDisplayName()), 0));
                    Html.escapeHtml(getCallingAppName()),
                    Html.escapeHtml(selectedDevice.getDisplayName())), 0));

            mPairButton = findViewById(R.id.button_pair);
            mPairButton.setOnClickListener(v -> onDeviceConfirmed(getService().mSelectedDevice));
            getService().mSelectedDevice = selectedDevice;
@@ -108,8 +108,8 @@ public class CompanionDeviceActivity extends Activity {
            mPairButton = findViewById(R.id.button_pair);
            mPairButton.setVisibility(View.GONE);
            setTitle(Html.fromHtml(getString(R.string.chooser_title,
                    profileName,
                    getCallingAppName()), 0));
                    Html.escapeHtml(profileName),
                    Html.escapeHtml(getCallingAppName())), 0));
            mDeviceListView = findViewById(R.id.device_list);
            mDevicesAdapter = new DevicesAdapter();
            mDeviceListView.setAdapter(mDevicesAdapter);