am 549a39b4: DO NOT MERGE HTML injection fix for bluetooth pairing, issue 65946

* commit '549a39b49510dad27da588714f848dc891913239':
  DO NOT MERGE HTML injection fix for bluetooth pairing, issue 65946
This commit is contained in:
Rob Fletcher
2014-03-06 21:59:31 +00:00
committed by Android Git Automerger

View File

@@ -207,8 +207,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements
return null; return null;
} }
// Format the message string, then parse HTML style tags // HTML escape deviceName, Format the message string, then parse HTML style tags
String messageText = getString(messageId1, deviceName); String messageText = getString(messageId1, Html.escapeHtml(deviceName));
messageView.setText(Html.fromHtml(messageText)); messageView.setText(Html.fromHtml(messageText));
messageView2.setText(messageId2); messageView2.setText(messageId2);
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER); mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
@@ -220,7 +220,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements
private View createView(CachedBluetoothDeviceManager deviceManager) { private View createView(CachedBluetoothDeviceManager deviceManager) {
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null); View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null);
String name = deviceManager.getName(mDevice); // Escape device name to avoid HTML injection.
String name = Html.escapeHtml(deviceManager.getName(mDevice));
TextView messageView = (TextView) view.findViewById(R.id.message); TextView messageView = (TextView) view.findViewById(R.id.message);
String messageText; // formatted string containing HTML style tags String messageText; // formatted string containing HTML style tags