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

Commit 62c8430e authored by Sonny Sasaka's avatar Sonny Sasaka
Browse files

floss: Always copy bonded devices

This removes guard num_devices > 0, otherwise there is a bug where we
failed to set the property length to 0 and got uninitialized data
instead.

Bug: 207116922
Tag: #floss
Test: Call `list bonded` on btclient

Change-Id: I3886ed033e1710ff1400ef57dc6b6d53502cd673
parent 4786b942
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -656,10 +656,8 @@ bt_status_t btif_storage_get_adapter_property(bt_property_t* property) {
        "Property:BT_PROPERTY_ADAPTER_BONDED_DEVICES",
        __func__, bonded_devices.num_devices);

    if (bonded_devices.num_devices > 0) {
    property->len = bonded_devices.num_devices * RawAddress::kLength;
    memcpy(property->val, bonded_devices.devices, property->len);
    }

    /* if there are no bonded_devices, then length shall be 0 */
    return BT_STATUS_SUCCESS;