Skip to content

Commit d3f5063

Browse files
committed
[Bugfix] getBondedAddress index could go out of array bounds.
1 parent 2db8fed commit d3f5063

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

0 commit comments

Comments
 (0)