History

Bluetooth: btintel: Validate length before parsing diagnostics TLV

btintel_diagnostics() accesses tlv->val[0] without first validating that the diagnostics VSE is long enough to contain that field, so may cause reading data beyond the received frame. Fix by validating the length before access.

Zijun Hu committed 3 months ago

Commit b640ff91 parent af24e331 file · +3 −0Browse files

Unified · Split

drivers/bluetooth/btintel.c+3−0
@@ -3771,6 +3771,9 @@ static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb) · 3770 unmodified lines
37713771 {
37723772 struct intel_tlv *tlv = (void *)&skb->data[5];
37733773
3774+ if (skb->len < 5 + sizeof(*tlv) + sizeof(tlv->val[0]))
3775+ goto recv_frame;
3776+
37743777 /* The first event is always an event type TLV */
37753778 if (tlv->type != INTEL_TLV_TYPE_ID)
37763779 goto recv_frame;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t