diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-02-18 18:40:07 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-18 18:40:07 (GMT) |
| commit | ca82e3c0ec4d0d5ce4e1ffec98cc341cb5913446 (patch) | |
| tree | c10d6de3ad1bcf8509e32c85eeb8deede4cf6e97 /Python | |
| parent | 2e84e47626c6eafacc9f011cd9fccc8bf1c8508e (diff) | |
| download | cpython-ca82e3c0ec4d0d5ce4e1ffec98cc341cb5913446.zip cpython-ca82e3c0ec4d0d5ce4e1ffec98cc341cb5913446.tar.gz cpython-ca82e3c0ec4d0d5ce4e1ffec98cc341cb5913446.tar.bz2 | |
bpo-32869: Fix incorrect dst buffer size for MultiByteToWideChar (GH-5739)
This function expects the destination buffer size to be given
in wide characters, not bytes.
(cherry picked from commit b3b4a9d3001f1fc7df8efcccdce081de54fa5eab)
Co-authored-by: Alexey Izbyshev <izbyshev@users.noreply.github.com>
Diffstat (limited to 'Python')
| -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; |
