]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patches #925152, #1118602: Avoid reading after the end of the buffer
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 4 Mar 2005 14:38:07 +0000 (14:38 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 4 Mar 2005 14:38:07 +0000 (14:38 +0000)
in pyexpat.GetInputContext.

Misc/NEWS
Modules/pyexpat.c

index 93ca629d5db293cbc04acc508c8ab48535104d49..b43542950f00359aebcad6d6dcae10b9bbf5dbfd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -33,6 +33,9 @@ Core and builtins
 Extension Modules
 -----------------
 
+- Patches #925152, #1118602: Avoid reading after the end of the buffer
+  in pyexpat.GetInputContext.
+
 - Patch #1093585: raise a ValueError for negative history items in readline.
   {remove_history,replace_history}
 
index d359a7405c2fb813c5be80ad538394321f0247b2..e6c14f8a2db44d58cb5362ddf3da785c070e5747 100644 (file)
@@ -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);