Skip to content

Commit 8977376

Browse files
committed
[Bugfix] getBondedAddress index could go out of array bounds.
1 parent 0606e21 commit 8977376

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
@@ -685,7 +685,7 @@ NimBLEAddress NimBLEDevice::getBondedAddress(int index) {
685685
ble_addr_t peer_id_addrs[MYNEWT_VAL(BLE_STORE_MAX_BONDS)];
686686
int num_peers, rc;
687687
rc = ble_store_util_bonded_peers(&peer_id_addrs[0], &num_peers, MYNEWT_VAL(BLE_STORE_MAX_BONDS));
688-
if (rc != 0 || index > num_peers || index < 0) {
688+
if (rc != 0 || index >= num_peers || index < 0) {
689689
return NimBLEAddress{};
690690
}
691691

0 commit comments

Comments
 (0)