diff mbox series

[BlueZ,v1] mcp: replace sprintf() with snprintf() in cb_track_duration()

Message ID 20240628123647.547516-1-r.smirnov@omp.ru (mailing list archive)
State Accepted
Commit 9886a7557b3cd2e744cfb5d12679228a4caea1aa
Headers show
Series [BlueZ,v1] mcp: replace sprintf() with snprintf() in cb_track_duration() | 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/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Roman Smirnov June 28, 2024, 12:36 p.m. UTC
Use snprintf() instead of sprintf() to avoid buffer overflow.

Found with the SVACE static analysis tool
---
 profiles/audio/mcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com June 28, 2024, 2:19 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=866571

---Test result---

Test Summary:
CheckPatch                    PASS      0.45 seconds
GitLint                       PASS      0.32 seconds
BuildEll                      PASS      24.55 seconds
BluezMake                     PASS      1716.48 seconds
MakeCheck                     PASS      13.29 seconds
MakeDistcheck                 PASS      179.65 seconds
CheckValgrind                 PASS      251.46 seconds
CheckSmatch                   PASS      353.87 seconds
bluezmakeextell               PASS      120.00 seconds
IncrementalBuild              PASS      1449.13 seconds
ScanBuild                     PASS      1003.14 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org June 28, 2024, 3:10 p.m. UTC | #2
Hello:

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

On Fri, 28 Jun 2024 15:36:46 +0300 you wrote:
> Use snprintf() instead of sprintf() to avoid buffer overflow.
> 
> Found with the SVACE static analysis tool
> ---
>  profiles/audio/mcp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [BlueZ,v1] mcp: replace sprintf() with snprintf() in cb_track_duration()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9886a7557b3c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/profiles/audio/mcp.c b/profiles/audio/mcp.c
index 8d1b7588e..0a2991f20 100644
--- a/profiles/audio/mcp.c
+++ b/profiles/audio/mcp.c
@@ -169,7 +169,7 @@  static void cb_track_duration(struct bt_mcp *mcp, int32_t duration)
 	unsigned char buf[10];
 
 	/* MCP defines duration is int32 but api takes it as uint32 */
-	sprintf((char *)buf, "%d", duration);
+	snprintf((char *)buf, 10, "%d", duration);
 	media_player_set_metadata(mp, NULL, "Duration", buf, sizeof(buf));
 	media_player_metadata_changed(mp);
 }