Merge change 25780 into eclair

* changes:
  Reject lowercase characters in checkBluetoothAddress().
This commit is contained in:
Android (Google) Code Review
2009-09-18 16:51:36 -04:00

View File

@ -573,6 +573,7 @@ public final class BluetoothAdapter {
/** /**
* Validate a Bluetooth address, such as "00:43:A8:23:10:F0" * Validate a Bluetooth address, such as "00:43:A8:23:10:F0"
* <p>Alphabetic characters must be uppercase to be valid.
* *
* @param address Bluetooth address as string * @param address Bluetooth address as string
* @return true if the address is valid, false otherwise * @return true if the address is valid, false otherwise
@ -586,8 +587,9 @@ public final class BluetoothAdapter {
switch (i % 3) { switch (i % 3) {
case 0: case 0:
case 1: case 1:
if (Character.digit(c, 16) != -1) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) {
break; // hex character, OK // hex character, OK
break;
} }
return false; return false;
case 2: case 2: