diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-13 18:12:03 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-13 18:12:03 (GMT) |
commit | ee7c8f9af80ac2fa76987ca25397624915cbaea4 (patch) | |
tree | 339efcfec2c8c0e5af2fd33f663d508ea57929ea /Modules | |
parent | 5aa96895d8d5d2c76d75842a5e3c79ef4f09d895 (diff) | |
download | cpython-ee7c8f9af80ac2fa76987ca25397624915cbaea4.zip cpython-ee7c8f9af80ac2fa76987ca25397624915cbaea4.tar.gz cpython-ee7c8f9af80ac2fa76987ca25397624915cbaea4.tar.bz2 |
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.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index d59ebd8..69b2881 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -950,6 +950,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 = (char *)PyMem_Malloc(PyString_Size(source) + 2); if (buf == NULL) { |