summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-07-29 21:13:07 +1000
committerJames Ross-Gowan <rossy@jrg.systems>2017-07-29 21:13:07 +1000
commit28e3618e79ba027c28d2d651675f987b4347dfa9 (patch)
tree7c8b0a6314290a583c69e63cc1ba10285916fa8a
parentdf12f7691026a6012d4bd359919d63a1bd1a9cf6 (diff)
downloadmpv-28e3618e79ba027c28d2d651675f987b4347dfa9.tar.bz2
mpv-28e3618e79ba027c28d2d651675f987b4347dfa9.tar.xz
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
-rw-r--r--osdep/subprocess-win.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/osdep/subprocess-win.c b/osdep/subprocess-win.c
index c662fb6301..5df09cda78 100644
--- a/osdep/subprocess-win.c
+++ b/osdep/subprocess-win.c
@@ -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