From 6a58316a3e6ed39b814d6938ee1df788cf2bd024 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 6 Dec 2023 16:59:46 +0100
Subject: [PATCH] MEX files: disable clang-tidy false positive for call to
 std::strcpy

---
 mex/sources/ms-sbvar/mex_top_level.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mex/sources/ms-sbvar/mex_top_level.cc b/mex/sources/ms-sbvar/mex_top_level.cc
index 79432b8f08..825b289ddb 100644
--- a/mex/sources/ms-sbvar/mex_top_level.cc
+++ b/mex/sources/ms-sbvar/mex_top_level.cc
@@ -54,7 +54,8 @@ mexFunction(int nlhs, [[maybe_unused]] mxArray* plhs[], int nrhs, const mxArray*
   if (!(args[nargs] = static_cast<char*>(mxCalloc(strlen(mainarg) + 1, sizeof(char)))))
     mexErrMsgTxt("Error in MS-SBVAR MEX file: could not allocate memory. (2)");
 
-  strcpy(args[nargs++], mainarg);
+  // Disabling security warning, since by construction the destination is large enough
+  strcpy(args[nargs++], mainarg); // NOLINT(clang-analyzer-security.insecureAPI.strcpy)
 
   if (mxGetString(prhs[0], argument, mxGetN(prhs[0]) + 1))
     mexErrMsgTxt("Error in MS-SBVAR MEX file: error using mxGetString.\n");
-- 
GitLab