Bluetooth: hci_core: Fix possible buffer overflow
[ Upstream commit 81137162bfaa7278785b24c1fd2e9e74f082e8e4 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Sasha Levin
parent
6e96039070
commit
6d5a9d4a7b
@@ -2074,7 +2074,7 @@ int hci_get_dev_info(void __user *arg)
|
|||||||
else
|
else
|
||||||
flags = hdev->flags;
|
flags = hdev->flags;
|
||||||
|
|
||||||
strcpy(di.name, hdev->name);
|
strscpy(di.name, hdev->name, sizeof(di.name));
|
||||||
di.bdaddr = hdev->bdaddr;
|
di.bdaddr = hdev->bdaddr;
|
||||||
di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4);
|
di.type = (hdev->bus & 0x0f) | ((hdev->dev_type & 0x03) << 4);
|
||||||
di.flags = flags;
|
di.flags = flags;
|
||||||
|
|||||||
Reference in New Issue
Block a user