Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70d1e884 authored by Peilin Ye's avatar Peilin Ye Committed by Greg Kroah-Hartman
Browse files

Bluetooth: Prevent out-of-bounds read in hci_inquiry_result_evt()



commit 75bbd2ea50ba1c5d9da878a17e92eac02fe0fd3a upstream.

Check `num_rsp` before using it as for-loop counter.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarPeilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c26eaaf5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2444,7 +2444,7 @@ static void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)

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

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

	if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))