diff mbox series

[v1,1/4] Bluetooth: hci_core: Fix possible buffer overflow

Message ID 20240228171838.2414532-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit c6febaabc470e358dce0c15472545b2f4a12dd7f
Headers show
Series [v1,1/4] Bluetooth: hci_core: Fix possible buffer overflow | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz Feb. 28, 2024, 5:18 p.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com Feb. 28, 2024, 5:57 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=830790

---Test result---

Test Summary:
CheckPatch                    PASS      1.98 seconds
GitLint                       PASS      0.78 seconds
SubjectPrefix                 PASS      0.23 seconds
BuildKernel                   PASS      27.62 seconds
CheckAllWarning               PASS      30.48 seconds
CheckSparse                   PASS      36.06 seconds
CheckSmatch                   PASS      99.43 seconds
BuildKernel32                 PASS      26.97 seconds
TestRunnerSetup               PASS      494.99 seconds
TestRunner_l2cap-tester       PASS      18.05 seconds
TestRunner_iso-tester         PASS      28.19 seconds
TestRunner_bnep-tester        PASS      4.74 seconds
TestRunner_mgmt-tester        PASS      111.81 seconds
TestRunner_rfcomm-tester      PASS      7.28 seconds
TestRunner_sco-tester         PASS      14.85 seconds
TestRunner_ioctl-tester       PASS      7.76 seconds
TestRunner_mesh-tester        PASS      5.79 seconds
TestRunner_smp-tester         PASS      6.81 seconds
TestRunner_userchan-tester    PASS      4.95 seconds
IncrementalBuild              PASS      39.12 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 1, 2024, 7 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 28 Feb 2024 12:18:35 -0500 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [v1,1/4] Bluetooth: hci_core: Fix possible buffer overflow
    https://git.kernel.org/bluetooth/bluetooth-next/c/c6febaabc470
  - [v1,2/4] Bluetooth: msft: Fix memory leak
    https://git.kernel.org/bluetooth/bluetooth-next/c/14cfaede6ad1
  - [v1,3/4] Bluetooth: btusb: Fix memory leak
    https://git.kernel.org/bluetooth/bluetooth-next/c/875829da81e8
  - [v1,4/4] Bluetooth: bnep: Fix out-of-bound access
    https://git.kernel.org/bluetooth/bluetooth-next/c/cfbc55231f8e

You are awesome, thank you!
diff mbox series

Patch

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;