summaryrefslogtreecommitdiff
path: root/Source/cmCommandArgumentParserHelper.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-31 09:05:43 -0400
committerBrad King <brad.king@kitware.com>2018-07-31 09:34:00 -0400
commit9df0e1f98ac81ce309026be9098fe8f00ee2a30c (patch)
treeea2c228db80a6f617598b0a8dbcd4f27da7ab109 /Source/cmCommandArgumentParserHelper.cxx
parentb6d116e240dc4ae2fb63d24de0efbdd891b74fe6 (diff)
downloadcmake-9df0e1f98ac81ce309026be9098fe8f00ee2a30c.tar.gz
cmCommandArgumentParserHelper: Avoid -Wstringop-truncation warning
Use `memcpy` instead of `strncpy` to copy bytes from a buffer that may not be null terminated.
Diffstat (limited to 'Source/cmCommandArgumentParserHelper.cxx')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index ccb4f88b0d..c7210b4df8 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);