From 0fdd3ed5633266f0f7cee6c18f3c756d5fb3276a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 8 Jan 2021 16:14:08 +0000 Subject: [PATCH] src: avoid warning about strncpy without trailing NUL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é --- src/windows-cmdline-wrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/windows-cmdline-wrapper.c b/src/windows-cmdline-wrapper.c index 704e2d7..7299ab2 100644 --- a/src/windows-cmdline-wrapper.c +++ b/src/windows-cmdline-wrapper.c @@ -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);