summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorEdward AD <twuufnxlz@gmail.com>2023-10-10 13:36:57 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2023-10-13 20:03:04 -0700
commit18f547f3fc074500ab5d419cf482240324e73a7e (patch)
treebffb5e38bacaf2eaa7bb4933adbe36931d99f906 /net/bluetooth
parent9ee252868787ab5a26012d69e335c7371f54563a (diff)
downloadlinux-stable-18f547f3fc074500ab5d419cf482240324e73a7e.tar.gz
linux-stable-18f547f3fc074500ab5d419cf482240324e73a7e.tar.bz2
linux-stable-18f547f3fc074500ab5d419cf482240324e73a7e.zip
Bluetooth: hci_sock: fix slab oob read in create_monitor_event
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>
Diffstat (limited to 'net/bluetooth')
-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 5e4f718073b7..72abe54c45dd 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -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;