xwin: fix possibly missing string termination

../hw/xwin/InitOutput.c: In function ‘winFixupPaths’:
747../hw/xwin/InitOutput.c:578:9: warning: ‘strncpy’ output truncated before terminating nul copying 5 bytes from a string of the same length [-Wstringop-truncation]
748  578 |         strncpy(buffer, "HOME=", 5);
749      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1295>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-14 14:42:59 +01:00 committed by Marge Bot
parent f855e35df2
commit 123a473e33

View File

@ -577,9 +577,9 @@ winFixupPaths(void)
putenv(buffer); putenv(buffer);
} }
if (getenv("HOME") == NULL) { if (getenv("HOME") == NULL) {
char buffer[MAX_PATH + 5]; char buffer[MAX_PATH + 5] = {0};
strncpy(buffer, "HOME=", 5); strncpy(buffer, "HOME=", 6);
/* query appdata directory */ /* query appdata directory */
if (SHGetFolderPathA if (SHGetFolderPathA