diff mbox series

[BlueZ,v1] rctest: replace sprintf() with snprintf() in recv_mode()

Message ID 20240628131531.551699-1-r.smirnov@omp.ru (mailing list archive)
State Accepted
Commit 559e40a8b9a413119cebe2f5dfa2ece04daff6ff
Headers show
Series [BlueZ,v1] rctest: replace sprintf() with snprintf() in recv_mode() | 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 warning CheckSparse WARNING tools/rctest.c:625:33: warning: non-ANSI function declaration of function 'automated_send_recv'
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, 1:15 p.m. UTC
Use snprintf() instead of sprintf() to avoid buffer overflow.

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

Comments

bluez.test.bot@gmail.com June 28, 2024, 3:04 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=866591

---Test result---

Test Summary:
CheckPatch                    PASS      0.45 seconds
GitLint                       PASS      0.32 seconds
BuildEll                      PASS      24.95 seconds
BluezMake                     PASS      1760.44 seconds
MakeCheck                     PASS      13.72 seconds
MakeDistcheck                 PASS      181.46 seconds
CheckValgrind                 PASS      255.22 seconds
CheckSmatch                   WARNING   358.53 seconds
bluezmakeextell               PASS      121.47 seconds
IncrementalBuild              PASS      1520.73 seconds
ScanBuild                     PASS      1023.90 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
tools/rctest.c:625:33: warning: non-ANSI function declaration of function 'automated_send_recv'


---
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 16:15:30 +0300 you wrote:
> Use snprintf() instead of sprintf() to avoid buffer overflow.
> 
> Found with the SVACE static analysis tool.
> ---
>  tools/rctest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/rctest.c b/tools/rctest.c
index ff91eb2f1..e39d313eb 100644
--- a/tools/rctest.c
+++ b/tools/rctest.c
@@ -500,7 +500,7 @@  static void recv_mode(int sk)
 					timestamp = 0;
 					memset(ts, 0, sizeof(ts));
 				} else {
-					sprintf(ts, "[%lld.%lld] ",
+					snprintf(ts, sizeof(ts), "[%lld.%lld] ",
 							(long long)tv.tv_sec,
 							(long long)tv.tv_usec);
 				}