diff options
author | Stefan Krah <skrah@bytereef.org> | 2012-08-20 12:14:49 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2012-08-20 12:14:49 (GMT) |
commit | 000fde9651079209d5e4688c70099e326f2a57f9 (patch) | |
tree | 8ae3d6103c0435c1ce5867b9a750f410e49294b3 /Modules/zipimport.c | |
parent | 6adf2433e4e1936dba5335311b3f86051156eb81 (diff) | |
download | cpython-000fde9651079209d5e4688c70099e326f2a57f9.zip cpython-000fde9651079209d5e4688c70099e326f2a57f9.tar.gz cpython-000fde9651079209d5e4688c70099e326f2a57f9.tar.bz2 |
Closes #15737: Fix potential NULL dereference in zipimport.c.
Diffstat (limited to 'Modules/zipimport.c')
-rw-r--r-- | Modules/zipimport.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index ac8dd09..12bfe23 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -947,8 +947,6 @@ read_directory(PyObject *archive) else charset = "cp437"; nameobj = PyUnicode_Decode(name, name_size, charset, NULL); - if (PyUnicode_READY(nameobj) == -1) - goto error; if (nameobj == NULL) { if (bootstrap) PyErr_Format(PyExc_NotImplementedError, @@ -957,6 +955,8 @@ read_directory(PyObject *archive) PY_MAJOR_VERSION, PY_MINOR_VERSION); goto error; } + if (PyUnicode_READY(nameobj) == -1) + goto error; path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj); if (path == NULL) goto error; |