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

Commit 9c415d5b authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Automerger Merge Worker
Browse files

Merge "Prevent create bond for null MAC address" am: b0c01df9 am: 8d313940 am: 982531f1

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1776317

Change-Id: I82b1ff5730af45af0a6a6a27b216a375ca84bd8e
parents 274061cd 982531f1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1096,6 +1096,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
    /** 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.
@@ -1493,6 +1495,10 @@ public final class BluetoothDevice implements Parcelable, Attributable {
            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, mAttributionSource);