Skip to content

Commit a9b1700

Browse files
author
loewis
committed
Patches #925152, #1118602: Avoid reading after the end of the buffer
in pyexpat.GetInputContext. Will backport to 2.4. git-svn-id: http://svn.python.org/projects/python/trunk@38570 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 9bc56d4 commit a9b1700

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Core and builtins
4444
Extension Modules
4545
-----------------
4646

47+
- Patches #925152, #1118602: Avoid reading after the end of the buffer
48+
in pyexpat.GetInputContext.
49+
4750
- Patches #749830, #1144555: allow UNIX mmap size to default to current
4851
file size.
4952

Modules/pyexpat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ xmlparse_GetInputContext(xmlparseobject *self, PyObject *args)
10821082
= XML_GetInputContext(self->itself, &offset, &size);
10831083

10841084
if (buffer != NULL)
1085-
result = PyString_FromStringAndSize(buffer + offset, size);
1085+
result = PyString_FromStringAndSize(buffer + offset, size - offset);
10861086
else {
10871087
result = Py_None;
10881088
Py_INCREF(result);

0 commit comments

Comments
 (0)