[Python-checkins] python/dist/src/Python codecs.c,2.15,2.16

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Mon, 02 Sep 2002 11:22:35 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv28135/Python

Modified Files:
	codecs.c 
Log Message:
Check string for NULL before using it to format the error message.
(Spotted by Neal Norwitz)


Index: codecs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -d -r2.15 -r2.16
*** codecs.c	2 Sep 2002 13:14:31 -0000	2.15
--- codecs.c	2 Sep 2002 18:22:32 -0000	2.16
***************
*** 466,472 ****
  	    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);
  	}
      }
--- 466,475 ----
  	    PyObject *string = PyObject_Str(name);
  	    Py_DECREF(name);
! 	    if (string != NULL) {
! 	        PyErr_Format(PyExc_TypeError,
! 		    "don't know how to handle %.400s in error callback",
! 		    PyString_AS_STRING(string));
! 	        Py_DECREF(string);
! 	    }
  	}
      }