diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-16 22:52:09 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-16 22:52:09 (GMT) |
commit | 350147b5cacee7a288875007cddf1f7a321a21e2 (patch) | |
tree | 0a80bfc7d28ecbe2fe90af16dab889a1f1294096 /Python/fileutils.c | |
parent | 3f711f4a3e6e2eb9ea9d9d0f841766e9df74ea29 (diff) | |
download | cpython-350147b5cacee7a288875007cddf1f7a321a21e2.zip cpython-350147b5cacee7a288875007cddf1f7a321a21e2.tar.gz cpython-350147b5cacee7a288875007cddf1f7a321a21e2.tar.bz2 |
_Py_wreadlink(): catch _Py_char2wchar() failure
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r-- | Python/fileutils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index cfafd86..147636f 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); |