mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
subprocess-win: fix swprintf usage
The count parameter refers to the number of wide-characters to write to the buffer (including the terminating NUL character, which is always added,) not the number of bytes. See C99 7.24.2.3 or https://msdn.microsoft.com/en-us/library/ybk95axf.aspx
This commit is contained in:
parent
df12f76910
commit
28e3618e79
@ -112,7 +112,8 @@ static int create_overlapped_pipe(HANDLE *read, HANDLE *write)
|
||||
unsigned long id = atomic_fetch_add(&counter, 1);
|
||||
unsigned pid = GetCurrentProcessId();
|
||||
wchar_t buf[36];
|
||||
swprintf(buf, sizeof(buf), L"\\\\.\\pipe\\mpv-anon-%08x-%08lx", pid, id);
|
||||
swprintf(buf, MP_ARRAY_SIZE(buf), L"\\\\.\\pipe\\mpv-anon-%08x-%08lx",
|
||||
pid, id);
|
||||
|
||||
// The function for creating anonymous pipes (CreatePipe) can't create
|
||||
// overlapped pipes, so instead, use a named pipe with a unique name
|
||||
|
Loading…
Reference in New Issue
Block a user