summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-10-03 19:39:54 +0000
committerAndrew M. Kuchling <amk@amk.ca>2006-10-03 19:39:54 +0000
commit397935f4a3eb55810478910e4a0443f1fcb5bcb5 (patch)
treee202cebaf4ee7ca0f5dc373f5bae4aa60cd81303 /Modules
parent167392229615c4db0d8226e607bc12c841e298c6 (diff)
downloadcpython-git-397935f4a3eb55810478910e4a0443f1fcb5bcb5.tar.gz
[Backport r51252 | neal.norwitz]
It's very unlikely, though possible that source is not a string. Verify that PyString_AsString() returns a valid pointer. (The problem can arise when zlib.decompress doesn't return a string.) Klocwork 346
Diffstat (limited to 'Modules')
-rw-r--r--Modules/zipimport.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 2dc504837e..fe552a2075 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -955,6 +955,9 @@ normalize_line_endings(PyObject *source)
char *buf, *q, *p = PyString_AsString(source);
PyObject *fixed_source;
+ if (!p)
+ return NULL;
+
/* one char extra for trailing \n and one for terminating \0 */
buf = PyMem_Malloc(PyString_Size(source) + 2);
if (buf == NULL) {