diff options
| author | Etienne Ruffieux <eruffieux@google.com> | 2021-07-15 12:36:20 +0000 |
|---|---|---|
| committer | Jakub Pawlowski <jpawlowski@google.com> | 2021-07-28 17:57:35 +0000 |
| commit | 84abea03d6df1da732edeb8495f8775f7279cad2 (patch) | |
| tree | 8991b924b7bfc717d231c22508e06d9a9922deec /core/java/android/bluetooth/BluetoothDevice.java | |
| parent | adcff137904eb37a6461a59194374a0dc67f498d (diff) | |
Prevent create bond for null MAC address
Tag: #feature
Bug: 193702115
Test: atest BluetoothInstrumentationTests
Change-Id: I5684f00cf4a567a899c958b94af22ccf5067b476
Diffstat (limited to 'core/java/android/bluetooth/BluetoothDevice.java')
| -rw-r--r-- | core/java/android/bluetooth/BluetoothDevice.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 07dbe52a2c66..0969ec2269b1 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -1035,6 +1035,8 @@ public final class BluetoothDevice implements Parcelable { /** Address is either resolvable, non-resolvable or static. */ public static final int ADDRESS_TYPE_RANDOM = 1; + private static final String NULL_MAC_ADDRESS = "00:00:00:00:00:00"; + /** * Lazy initialization. Guaranteed final after first object constructed, or * getService() called. @@ -1371,6 +1373,10 @@ public final class BluetoothDevice implements Parcelable { Log.w(TAG, "BT not enabled, createBondOutOfBand failed"); return false; } + if (NULL_MAC_ADDRESS.equals(mAddress)) { + Log.e(TAG, "Unable to create bond, invalid address " + mAddress); + return false; + } try { return service.createBond(this, transport, remoteP192Data, remoteP256Data); } catch (RemoteException e) { |
