Skip to content

Commit

Permalink
Bluetooth: hci_sock: fix slab oob read in create_monitor_event
Browse files Browse the repository at this point in the history
When accessing hdev->name, the actual string length should prevail

Reported-by: syzbot+c90849c50ed209d77689@syzkaller.appspotmail.com
Fixes: dcda165 ("Bluetooth: hci_core: Fix build warnings")
Signed-off-by: Edward AD <twuufnxlz@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information
Edward AD authored and Luiz Augusto von Dentz committed Oct 14, 2023
1 parent 9ee2528 commit 18f547f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
ni->type = hdev->dev_type;
ni->bus = hdev->bus;
bacpy(&ni->bdaddr, &hdev->bdaddr);
memcpy(ni->name, hdev->name, 8);
memcpy(ni->name, hdev->name, strlen(hdev->name));

opcode = cpu_to_le16(HCI_MON_NEW_INDEX);
break;
Expand Down

0 comments on commit 18f547f

Please sign in to comment.