[Python-checkins] python/dist/src/Python exceptions.c,1.35,1.36

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Mon, 02 Sep 2002 09:10:09 -0700


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

Modified Files:
	exceptions.c 
Log Message:
Limit the length of attribute names in exception messages
to prevent buffer overflows (spotted by Neal Norwitz).


Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** exceptions.c	2 Sep 2002 13:14:32 -0000	1.35
--- exceptions.c	2 Sep 2002 16:10:06 -0000	1.36
***************
*** 853,857 ****
  	return -1;
      if (!PyInt_Check(attr)) {
! 	PyErr_Format(PyExc_TypeError, "%s attribute must be int", name);
  	Py_DECREF(attr);
  	return -1;
--- 853,857 ----
  	return -1;
      if (!PyInt_Check(attr)) {
! 	PyErr_Format(PyExc_TypeError, "%.200s attribute must be int", name);
  	Py_DECREF(attr);
  	return -1;
***************
*** 885,889 ****
  	return NULL;
      if (!PyString_Check(attr)) {
! 	PyErr_Format(PyExc_TypeError, "%s attribute must be str", name);
  	Py_DECREF(attr);
  	return NULL;
--- 885,889 ----
  	return NULL;
      if (!PyString_Check(attr)) {
! 	PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name);
  	Py_DECREF(attr);
  	return NULL;
***************
*** 915,919 ****
  	return NULL;
      if (!PyUnicode_Check(attr)) {
! 	PyErr_Format(PyExc_TypeError, "%s attribute must be unicode", name);
  	Py_DECREF(attr);
  	return NULL;
--- 915,919 ----
  	return NULL;
      if (!PyUnicode_Check(attr)) {
! 	PyErr_Format(PyExc_TypeError, "%.200s attribute must be unicode", name);
  	Py_DECREF(attr);
  	return NULL;