Mercurial > cpython-lru_cache-weakref
diff Python/fileutils.c @ 65410:6dcba93d6262
_Py_wreadlink(): catch _Py_char2wchar() failure
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Sat, 16 Oct 2010 22:52:09 +0000 |
| parents | e1dc9861b43f |
| children | df0e348e7176 |
line wrap: on
line diff
--- a/Python/fileutils.c Sat Oct 16 22:47:37 2010 +0000 +++ b/Python/fileutils.c Sat Oct 16 22:52:09 2010 +0000 @@ -326,6 +326,10 @@ } cbuf[res] = '\0'; /* buf will be null terminated */ wbuf = _Py_char2wchar(cbuf); + if (wbuf == NULL) { + errno = EINVAL; + return -1; + } r1 = wcslen(wbuf); if (bufsiz <= r1) { PyMem_Free(wbuf);
