]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Bluetooth: hci_sock: fix slab oob read in create_monitor_event
authorEdward AD <twuufnxlz@gmail.com>
Tue, 10 Oct 2023 05:36:57 +0000 (13:36 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sat, 14 Oct 2023 03:03:04 +0000 (20:03 -0700)
When accessing hdev->name, the actual string length should prevail

Reported-by: syzbot+c90849c50ed209d77689@syzkaller.appspotmail.com
Fixes: dcda165706b9 ("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>
net/bluetooth/hci_sock.c

index 5e4f718073b7ea8b62670df610c6552aa6cd325e..72abe54c45dd36d3659b34043de1a962bd1a47ee 100644 (file)
@@ -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;