Skip Montanaro: add string precisions to calls to PyErr_Format

to prevent possible buffer overruns.
This commit is contained in:
Guido van Rossum 2000-04-10 12:46:51 +00:00
parent fa972c987c
commit 5db862dd0c
5 changed files with 29 additions and 27 deletions

View file

@ -236,7 +236,7 @@ PyObject_Repr(v)
return NULL;
if (!PyString_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__repr__ returned non-string (type %s)",
"__repr__ returned non-string (type %.200s)",
res->ob_type->tp_name);
Py_DECREF(res);
return NULL;
@ -273,7 +273,7 @@ PyObject_Str(v)
return NULL;
if (!PyString_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__str__ returned non-string (type %s)",
"__str__ returned non-string (type %.200s)",
res->ob_type->tp_name);
Py_DECREF(res);
return NULL;