Skip to content

fix of bad indexing in ATTClass::handleNotifyOrInd which affected BLE… #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/utility/ATT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,14 +1359,14 @@ void ATTClass::handleNotifyOrInd(uint16_t connectionHandle, uint8_t opcode, uint
uint16_t handle;
} *handleNotifyOrInd = (HandleNotifyOrInd*)data;

uint8_t handle = handleNotifyOrInd->handle;
uint16_t handle = handleNotifyOrInd->handle;

for (int i = 0; i < ATT_MAX_PEERS; i++) {
if (_peers[i].connectionHandle != connectionHandle) {
for (int peer = 0; peer < ATT_MAX_PEERS; peer++) {
if (_peers[peer].connectionHandle != connectionHandle) {
continue;
}

BLERemoteDevice* device = _peers[i].device;
BLERemoteDevice* device = _peers[peer].device;

if (!device) {
break;
Expand All @@ -1384,7 +1384,7 @@ void ATTClass::handleNotifyOrInd(uint16_t connectionHandle, uint8_t opcode, uint
BLERemoteCharacteristic* c = s->characteristic(j);

if (c->valueHandle() == handle) {
c->writeValue(BLEDevice(_peers[i].addressType, _peers[i].address), &data[2], dlen - 2);
c->writeValue(BLEDevice(_peers[peer].addressType, _peers[peer].address), &data[2], dlen - 2);
}
}

Expand Down