Switch to using snprintf instead of sprintf

This commit is contained in:
Abdelrahman Said committed 2024-10-07 08:01:33 +01:00
1 parent 36e88ba84d
commit 1108ed686e
3 files changed
+38 -35

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
char expected_output[64] = {0};
const char *msg = "hello world";
u64 length = strlen(msg);
sprintf(expected_output, "%s\n", msg);
snprintf(expected_output, length + 2, "%s\n", msg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 64, "echo", msg);
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&