diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2008-10-22 15:49:45 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2008-10-22 15:49:45 -0400 |
commit | e3176b21a839e8bfa3ec4e56b1462839b7ea2d4c (patch) | |
tree | 174aa3921c8166d017e593ef0ce22f5d1a5b5175 | |
parent | b1b3db3ce10b08887e48c1bc608c65a50f8bd391 (diff) |
Print the expected and actual buffer size when a list length calculated
from a size field is larger than the remaining buffer space.
This error is unfortunately getting triggered by incorrect XML specs.
-rw-r--r-- | src/list.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -66,8 +66,9 @@ xpybList_init(xpybList *self, PyObject *args, PyObject *kw) if (PyObject_AsReadBuffer(parent, (const void **)&data, &datalen) < 0) return -1; - if (length * size + offset > datalen) { - PyErr_SetString(xpybExcept_base, "Protocol object buffer too short."); + if (size > 0 && length * size + offset > datalen) { + PyErr_Format(xpybExcept_base, "Protocol object buffer too short " + "(expected %zd got %zd).", length * size + offset, datalen); return -1; } |