summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-31 13:05:43 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-31 13:34:00 (GMT)
commit9df0e1f98ac81ce309026be9098fe8f00ee2a30c (patch)
treeea2c228db80a6f617598b0a8dbcd4f27da7ab109
parentb6d116e240dc4ae2fb63d24de0efbdd891b74fe6 (diff)
downloadCMake-9df0e1f98ac81ce309026be9098fe8f00ee2a30c.zip
CMake-9df0e1f98ac81ce309026be9098fe8f00ee2a30c.tar.gz
CMake-9df0e1f98ac81ce309026be9098fe8f00ee2a30c.tar.bz2
cmCommandArgumentParserHelper: Avoid -Wstringop-truncation warning
Use `memcpy` instead of `strncpy` to copy bytes from a buffer that may not be null terminated.
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index ccb4f88..c7210b4 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -172,7 +172,7 @@ void cmCommandArgumentParserHelper::AllocateParserType(
return;
}
char* out = new char[len + 1];
- strncpy(out, str, len);
+ memcpy(out, str, len);
out[len] = 0;
pt->str = out;
this->Variables.push_back(out);