Commit 350147b5 authored by Victor Stinner's avatar Victor Stinner

_Py_wreadlink(): catch _Py_char2wchar() failure

parent 3f711f4a
...@@ -326,6 +326,10 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) ...@@ -326,6 +326,10 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz)
} }
cbuf[res] = '\0'; /* buf will be null terminated */ cbuf[res] = '\0'; /* buf will be null terminated */
wbuf = _Py_char2wchar(cbuf); wbuf = _Py_char2wchar(cbuf);
if (wbuf == NULL) {
errno = EINVAL;
return -1;
}
r1 = wcslen(wbuf); r1 = wcslen(wbuf);
if (bufsiz <= r1) { if (bufsiz <= r1) {
PyMem_Free(wbuf); PyMem_Free(wbuf);
......
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