src: avoid warning about strncpy without trailing NUL

We know that the destination will already have a trailing NUL after the
three characters we're copying. The compiler can't see this though and
warns about lack of NUL termination.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-01-08 16:14:08 +00:00
parent f6007cfad1
commit 0fdd3ed563

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
// We expect our helper to end with .com
assert(strncmp(name + len - 3, "com", 4) == 0);
// replace .com with .exe
strncpy(name + len - 3, "exe", 3);
memcpy(name + len - 3, "exe", 3);
}
si.cb = sizeof(si);