From: Martin v. Löwis Date: Fri, 4 Mar 2005 14:37:01 +0000 (+0000) Subject: Patches #925152, #1118602: Avoid reading after the end of the buffer X-Git-Tag: v2.5a0~1960 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd78a6f7f8c507678238c7264f7426c3148b6a84;p=thirdparty%2FPython%2Fcpython.git Patches #925152, #1118602: Avoid reading after the end of the buffer in pyexpat.GetInputContext. Will backport to 2.4. --- diff --git a/Misc/NEWS b/Misc/NEWS index a41b61641588..9f7dbddec95e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,6 +44,9 @@ Core and builtins 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 file size. diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index d359a7405c2f..e6c14f8a2db4 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1082,7 +1082,7 @@ xmlparse_GetInputContext(xmlparseobject *self, PyObject *args) = XML_GetInputContext(self->itself, &offset, &size); if (buffer != NULL) - result = PyString_FromStringAndSize(buffer + offset, size); + result = PyString_FromStringAndSize(buffer + offset, size - offset); else { result = Py_None; Py_INCREF(result);