Bluetooth: Fix bug in LocalDeviceImpl::ReturnLinkKeys

The while loop iterating through the link keys was missing
a decrement for the counter numKeys. This resulted in an
infinite loop that would eventually attempt to access
invalid memory address, causing a segmentation violation
(SIGSEGV). As apparent in debugger.

Added numKeys-- decrement to ensure the loop terminates correctly.

Change-Id: I0922392f85efff8bdce8550b55be36268fe5699a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10690
Reviewed-by: Rene Gollent <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
shivamsinghydv
2026-04-08 21:50:18 +00:00
committed by waddlesplash
parent af3f2fdb80
commit 757e60f86b
@@ -1259,6 +1259,7 @@ LocalDeviceImpl::ReturnLinkKeys(struct hci_ev_return_link_keys* returnedKeys)
LinkKeyUtils::ToString(linkKeys->link_key).String());
linkKeys++;
numKeys--;
}
}