diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-02 18:22:32 +0000 |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-02 18:22:32 +0000 |
commit | 8ccb19030a44200da6f7ab6ef3f45fe4be4a2bae (patch) | |
tree | 618df3f514e492a98c92537ca7b8b0725d05c67a /Python/codecs.c | |
parent | 80298d62f08397b097588efcbf0161e162f769dd (diff) | |
download | cpython-8ccb19030a44200da6f7ab6ef3f45fe4be4a2bae.tar.gz |
Check string for NULL before using it to format the error message.
(Spotted by Neal Norwitz)
Diffstat (limited to 'Python/codecs.c')
-rw-r--r-- | Python/codecs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index 09cba7516c..12dfe28f84 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -465,9 +465,12 @@ static void wrong_exception_type(PyObject *exc) if (name != NULL) { PyObject *string = PyObject_Str(name); Py_DECREF(name); - PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", - PyString_AS_STRING(string)); - Py_DECREF(string); + if (string != NULL) { + PyErr_Format(PyExc_TypeError, + "don't know how to handle %.400s in error callback", + PyString_AS_STRING(string)); + Py_DECREF(string); + } } } } |