summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorEdward AD <twuufnxlz@gmail.com>2023-10-10 08:36:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-25 12:13:33 +0300
commit98e48a4fa0c255d3599a735d6bc56c06fae02d79 (patch)
treed6e053895c1a8760f488c1384548145cc1e3ef57 /net
parentd66259c0dcaf1403697add138be0933e2ed8067b (diff)
downloadlinux-98e48a4fa0c255d3599a735d6bc56c06fae02d79.tar.xz
Bluetooth: hci_sock: fix slab oob read in create_monitor_event
commit 18f547f3fc074500ab5d419cf482240324e73a7e upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_sock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 9b1658346396..8c8a336a3ed3 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -425,7 +425,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;