[Python-checkins] r85580 - python/branches/py3k/Python/fileutils.c

victor.stinner python-checkins at python.org
Sun Oct 17 00:52:09 CEST 2010


Author: victor.stinner
Date: Sun Oct 17 00:52:09 2010
New Revision: 85580

Log:
_Py_wreadlink(): catch _Py_char2wchar() failure


Modified:
   python/branches/py3k/Python/fileutils.c

Modified: python/branches/py3k/Python/fileutils.c
==============================================================================
--- python/branches/py3k/Python/fileutils.c	(original)
+++ python/branches/py3k/Python/fileutils.c	Sun Oct 17 00:52:09 2010
@@ -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);


More information about the Python-checkins mailing list