Skip to content

Commit 6854785

Browse files
committed
[Bugfix] getBondedAddress index could go out of array bounds.
1 parent 557e291 commit 6854785

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/NimBLEDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ NimBLEAddress NimBLEDevice::getBondedAddress(int index) {
689689
ble_addr_t peer_id_addrs[MYNEWT_VAL(BLE_STORE_MAX_BONDS)];
690690
int num_peers, rc;
691691
rc = ble_store_util_bonded_peers(&peer_id_addrs[0], &num_peers, MYNEWT_VAL(BLE_STORE_MAX_BONDS));
692-
if (rc != 0 || index > num_peers || index < 0) {
692+
if (rc != 0 || index >= num_peers || index < 0) {
693693
return NimBLEAddress{};
694694
}
695695

0 commit comments

Comments
 (0)