Explorar o código

cmCommandArgumentParserHelper: Avoid -Wstringop-truncation warning

Use `memcpy` instead of `strncpy` to copy bytes from a buffer that
may not be null terminated.
Brad King %!s(int64=7) %!d(string=hai) anos
pai
achega
9df0e1f98a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Source/cmCommandArgumentParserHelper.cxx

+ 1 - 1
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);