mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
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.
This commit is contained in:
parent
e8eb972514
commit
b3b4a9d300
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue