From 9b6f5f83f84d2db3924999fa61233fc7396b1fbb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 14 Dec 2020 16:52:12 +0100 Subject: Avoid use of strcat() --- .clang-tidy | 1 - src/jack.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9405211..3f9683c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,7 +14,6 @@ Checks: > -cert-err34-c, -clang-analyzer-core.CallAndMessage, -clang-analyzer-optin.cplusplus.VirtualCall, - -clang-analyzer-security.insecureAPI.strcpy, -cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-macro-usage, -cppcoreguidelines-owning-memory, diff --git a/src/jack.c b/src/jack.c index 408746c..d53c452 100644 --- a/src/jack.c +++ b/src/jack.c @@ -510,8 +510,7 @@ jack_initialize(jack_client_t* const client, const char* const load_init) /* Build full command line with "program" name for building argv */ const size_t cmd_len = strlen("jalv ") + args_len; char* const cmd = (char*)calloc(cmd_len + 1, 1); - strcat(cmd, "jalv "); - strcat(cmd, load_init); + snprintf(cmd, cmd_len + 1, "jalv %s", load_init); /* Build argv */ int argc = 0; -- cgit v1.2.1