From 757e60f86b420c963569666ee84c5100708b799a Mon Sep 17 00:00:00 2001 From: shivamsinghydv Date: Wed, 8 Apr 2026 19:35:08 +0530 Subject: [PATCH] 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 Reviewed-by: waddlesplash --- src/servers/bluetooth/LocalDeviceImpl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/servers/bluetooth/LocalDeviceImpl.cpp b/src/servers/bluetooth/LocalDeviceImpl.cpp index 0af7c3dae8..18f07f31a0 100644 --- a/src/servers/bluetooth/LocalDeviceImpl.cpp +++ b/src/servers/bluetooth/LocalDeviceImpl.cpp @@ -1259,6 +1259,7 @@ LocalDeviceImpl::ReturnLinkKeys(struct hci_ev_return_link_keys* returnedKeys) LinkKeyUtils::ToString(linkKeys->link_key).String()); linkKeys++; + numKeys--; } }