summaryrefslogtreecommitdiffstats
path: root/Python/exceptions.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2002-09-02 16:10:06 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2002-09-02 16:10:06 (GMT)
commitfd08e4c9edf63590c23ffb6f68c43d5015078c0b (patch)
tree94909789b7dc59b5afe83f71f21affaec1f5e493 /Python/exceptions.c
parentf57b22a716a18b6246e11279985bf86635e4a078 (diff)
downloadcpython-fd08e4c9edf63590c23ffb6f68c43d5015078c0b.zip
cpython-fd08e4c9edf63590c23ffb6f68c43d5015078c0b.tar.gz
cpython-fd08e4c9edf63590c23ffb6f68c43d5015078c0b.tar.bz2
Limit the length of attribute names in exception messages
to prevent buffer overflows (spotted by Neal Norwitz).
Diffstat (limited to 'Python/exceptions.c')
-rw-r--r--Python/exceptions.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/exceptions.c b/Python/exceptions.c
index 1667cd9..47a4e4d 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -852,7 +852,7 @@ int get_int(PyObject *exc, const char *name, int *value)
if (!attr)
return -1;
if (!PyInt_Check(attr)) {
- PyErr_Format(PyExc_TypeError, "%s attribute must be int", name);
+ PyErr_Format(PyExc_TypeError, "%.200s attribute must be int", name);
Py_DECREF(attr);
return -1;
}
@@ -884,7 +884,7 @@ PyObject *get_string(PyObject *exc, const char *name)
if (!attr)
return NULL;
if (!PyString_Check(attr)) {
- PyErr_Format(PyExc_TypeError, "%s attribute must be str", name);
+ PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name);
Py_DECREF(attr);
return NULL;
}
@@ -914,7 +914,7 @@ PyObject *get_unicode(PyObject *exc, const char *name)
if (!attr)
return NULL;
if (!PyUnicode_Check(attr)) {
- PyErr_Format(PyExc_TypeError, "%s attribute must be unicode", name);
+ PyErr_Format(PyExc_TypeError, "%.200s attribute must be unicode", name);
Py_DECREF(attr);
return NULL;
}