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

Commit 55e66f1b authored by Nick Pelly's avatar Nick Pelly
Browse files

Reject lowercase characters in checkBluetoothAddress().

This keeps consistency with Bluez which uses upper case string address. It's
important to keep the case the same so that .equals() in BluetoothService.java
work.

Change-Id: I6404ca137d0aec3cc2e6e7cb79763d5305a03547
parent 37e0828c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -573,6 +573,7 @@ public final class BluetoothAdapter {

    /**
     * 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
     * @return true if the address is valid, false otherwise
@@ -586,8 +587,9 @@ public final class BluetoothAdapter {
            switch (i % 3) {
            case 0:
            case 1:
                if (Character.digit(c, 16) != -1) {
                    break;  // hex character, OK
                if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) {
                    // hex character, OK
                    break;
                }
                return false;
            case 2: