mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 04:49:45 -05:00
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:
@@ -172,7 +172,7 @@ void cmCommandArgumentParserHelper::AllocateParserType(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char* out = new char[len + 1];
|
char* out = new char[len + 1];
|
||||||
strncpy(out, str, len);
|
memcpy(out, str, len);
|
||||||
out[len] = 0;
|
out[len] = 0;
|
||||||
pt->str = out;
|
pt->str = out;
|
||||||
this->Variables.push_back(out);
|
this->Variables.push_back(out);
|
||||||
|
|||||||
Reference in New Issue
Block a user