From: Victor Stinner Date: Sat, 16 Oct 2010 22:52:09 +0000 (+0000) Subject: _Py_wreadlink(): catch _Py_char2wchar() failure X-Git-Tag: v3.2a4~521 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=350147b5cacee7a288875007cddf1f7a321a21e2;p=thirdparty%2FPython%2Fcpython.git _Py_wreadlink(): catch _Py_char2wchar() failure --- diff --git a/Python/fileutils.c b/Python/fileutils.c index cfafd865c54d..147636f2c789 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -326,6 +326,10 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) } 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);