Skip Montanaro: add string precisions to calls to PyErr_Format
to prevent possible buffer overruns.
diff --git a/Objects/object.c b/Objects/object.c
index ab10e3e..265ab9b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -236,7 +236,7 @@
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 @@
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;