mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Skip Montanaro: add string precisions to calls to PyErr_Format
to prevent possible buffer overruns.
This commit is contained in:
parent
fa972c987c
commit
5db862dd0c
5 changed files with 29 additions and 27 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue