Skip to content

Commit 75bbd2e

Browse files
peilin-yeholtmann
authored andcommitted
Bluetooth: Prevent out-of-bounds read in hci_inquiry_result_evt()
Check `num_rsp` before using it as for-loop counter. Cc: [email protected] Signed-off-by: Peilin Ye <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 3344537 commit 75bbd2e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/bluetooth/hci_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,7 @@ static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
25172517

25182518
BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
25192519

2520-
if (!num_rsp)
2520+
if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1)
25212521
return;
25222522

25232523
if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))

0 commit comments

Comments
 (0)