diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-02 18:22:32 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-02 18:22:32 (GMT) |
commit | f7bcd1d65c3435f4c3fd6ab97ffe479891463d23 (patch) | |
tree | 5f1e0368599a5d10e2ecec2deeea9ca8fd3cf062 /Python | |
parent | 70bb0d4e65f7c42aeb138a38735210107ad1ca53 (diff) | |
download | cpython-f7bcd1d65c3435f4c3fd6ab97ffe479891463d23.zip cpython-f7bcd1d65c3435f4c3fd6ab97ffe479891463d23.tar.gz cpython-f7bcd1d65c3435f4c3fd6ab97ffe479891463d23.tar.bz2 |
Check string for NULL before using it to format the error message.
(Spotted by Neal Norwitz)
Diffstat (limited to 'Python')
-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 09cba75..12dfe28 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); + } } } } |