linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/4] Bluetooth: hci_core: Fix possible buffer overflow
@ 2024-02-28 17:18 Luiz Augusto von Dentz
  2024-02-28 17:18 ` [PATCH v1 2/4] Bluetooth: msft: Fix memory leak Luiz Augusto von Dentz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-02-28 17:18 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

struct hci_dev_info has a fixed size name[8] field so in the event that
hdev->name is bigger than that strcpy would attempt to write past its
size, so this fixes this problem by switching to use strscpy.

Fixes: dcda165706b9 ("Bluetooth: hci_core: Fix build warnings")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2821a42cefdc..3715d2f3616f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -908,7 +908,7 @@ int hci_get_dev_info(void __user *arg)
 	else
 		flags = hdev->flags;
 
-	strcpy(di.name, hdev->name);
+	strscpy(di.name, hdev->name, sizeof(di.name));
 	di.bdaddr   = hdev->bdaddr;
 	di.type     = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4);
 	di.flags    = flags;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-01 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28 17:18 [PATCH v1 1/4] Bluetooth: hci_core: Fix possible buffer overflow Luiz Augusto von Dentz
2024-02-28 17:18 ` [PATCH v1 2/4] Bluetooth: msft: Fix memory leak Luiz Augusto von Dentz
2024-02-28 17:18 ` [PATCH v1 3/4] Bluetooth: btusb: " Luiz Augusto von Dentz
2024-02-28 17:18 ` [PATCH v1 4/4] Bluetooth: bnep: Fix out-of-bound access Luiz Augusto von Dentz
2024-02-28 17:57 ` [v1,1/4] Bluetooth: hci_core: Fix possible buffer overflow bluez.test.bot
2024-03-01 19:00 ` [PATCH v1 1/4] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).