diff options
author | Alexey Izbyshev <izbyshev@users.noreply.github.com> | 2018-02-18 17:57:24 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-02-18 17:57:24 (GMT) |
commit | b3b4a9d3001f1fc7df8efcccdce081de54fa5eab (patch) | |
tree | f7703c631f9a4f6c17e8a71361a42e8a68a5f0a2 | |
parent | e8eb972514cad6086b752754c1d34d703c04dd82 (diff) | |
download | cpython-b3b4a9d3001f1fc7df8efcccdce081de54fa5eab.zip cpython-b3b4a9d3001f1fc7df8efcccdce081de54fa5eab.tar.gz cpython-b3b4a9d3001f1fc7df8efcccdce081de54fa5eab.tar.bz2 |
bpo-32869: Fix incorrect dst buffer size for MultiByteToWideChar (#5739)
This function expects the destination buffer size to be given
in wide characters, not bytes.
-rw-r--r-- | Python/fileutils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index 3cf8b7a..32aeea4 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1289,7 +1289,8 @@ _Py_fopen_obj(PyObject *path, const char *mode) if (wpath == NULL) return NULL; - usize = MultiByteToWideChar(CP_ACP, 0, mode, -1, wmode, sizeof(wmode)); + usize = MultiByteToWideChar(CP_ACP, 0, mode, -1, + wmode, Py_ARRAY_LENGTH(wmode)); if (usize == 0) { PyErr_SetFromWindowsErr(0); return NULL; |