cmCommandArgumentParserHelper: Avoid -Wstringop-truncation warning

Use `memcpy` instead of `strncpy` to copy bytes from a buffer that
may not be null terminated.
This commit is contained in:
Brad King
2018-07-31 09:05:43 -04:00
parent b6d116e240
commit 9df0e1f98a

View File

@@ -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);