Commit 8a79dccc authored by Victor Stinner's avatar Victor Stinner

_Py_stat(): ensure that path ends with a nul character

parent 09245d86
......@@ -1976,10 +1976,11 @@ _Py_stat(PyObject *unicode, struct stat *statbuf)
int err;
struct _stat wstatbuf;
len = PyUnicode_AsWideChar((PyUnicodeObject*)unicode, path,
sizeof(path) / sizeof(path[0]));
len = PyUnicode_AsWideChar((PyUnicodeObject*)unicode, path, MAXPATHLEN);
if (len == -1)
return -1;
path[len] = L'\0';
err = _wstat(path, &wstatbuf);
if (!err)
statbuf->st_mode = wstatbuf.st_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment