Skip to content

Commit

Permalink
fixup! mingw: use Unicode functions explicitly
Browse files Browse the repository at this point in the history
Let's pass the character count to `swprintf()`, not the byte count
(which could possibly cause overflows).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed May 22, 2019
1 parent 97d9140 commit 046e6ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compat/winansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void winansi_init(void)
}

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

0 comments on commit 046e6ff

Please sign in to comment.