Skip to content

Commit 046e6ff

Browse files
committed
fixup! mingw: use Unicode functions explicitly
Let's pass the character count to `swprintf()`, not the byte count (which could possibly cause overflows). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 97d9140 commit 046e6ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/winansi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ void winansi_init(void)
628628
}
629629

630630
/* create a named pipe to communicate with the console thread */
631-
if (swprintf(name, sizeof(name) - 1, L"\\\\.\\pipe\\winansi%lu",
631+
if (swprintf(name, ARRAY_SIZE(name) - 1, L"\\\\.\\pipe\\winansi%lu",
632632
GetCurrentProcessId()) < 0)
633633
die("Could not initialize winansi pipe name");
634634
hwrite = CreateNamedPipeW(name, PIPE_ACCESS_OUTBOUND,

0 commit comments

Comments
 (0)