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
3771{3771{
3772 struct intel_tlv *tlv = (void *)&skb->data[5];3772 struct intel_tlv *tlv = (void *)&skb->data[5];
3773 3773
3774 if (skb->len < 5 + sizeof(*tlv) + sizeof(tlv->val[0]))
3775 goto recv_frame;
3776
3774 /* The first event is always an event type TLV */3777 /* The first event is always an event type TLV */
3775 if (tlv->type != INTEL_TLV_TYPE_ID)3778 if (tlv->type != INTEL_TLV_TYPE_ID)
3776 goto recv_frame;3779 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