diff options
author | Brad King <brad.king@kitware.com> | 2018-07-31 13:05:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-07-31 13:34:00 (GMT) |
commit | 9df0e1f98ac81ce309026be9098fe8f00ee2a30c (patch) | |
tree | ea2c228db80a6f617598b0a8dbcd4f27da7ab109 | |
parent | b6d116e240dc4ae2fb63d24de0efbdd891b74fe6 (diff) | |
download | CMake-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.cxx | 2 |
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); |