Patches #925152, #1118602: Avoid reading after the end of the buffer

in pyexpat.GetInputContext. Will backport to 2.4.
This commit is contained in:
Martin v. Löwis 2005-03-04 14:37:01 +00:00
parent a2a9888f22
commit fd78a6f7f8
2 changed files with 4 additions and 1 deletions

View File

@ -44,6 +44,9 @@ Core and builtins
Extension Modules Extension Modules
----------------- -----------------
- Patches #925152, #1118602: Avoid reading after the end of the buffer
in pyexpat.GetInputContext.
- Patches #749830, #1144555: allow UNIX mmap size to default to current - Patches #749830, #1144555: allow UNIX mmap size to default to current
file size. file size.

View File

@ -1082,7 +1082,7 @@ xmlparse_GetInputContext(xmlparseobject *self, PyObject *args)
= XML_GetInputContext(self->itself, &offset, &size); = XML_GetInputContext(self->itself, &offset, &size);
if (buffer != NULL) if (buffer != NULL)
result = PyString_FromStringAndSize(buffer + offset, size); result = PyString_FromStringAndSize(buffer + offset, size - offset);
else { else {
result = Py_None; result = Py_None;
Py_INCREF(result); Py_INCREF(result);