Commit 4fc8ae42 authored by Guido van Rossum's avatar Guido van Rossum

Fix off-by-one bug in memmove() call in bytes_insert().

Fix by Pete Shinners (for his own bug :-).
parent 6f8fe151
...@@ -2313,7 +2313,7 @@ bytes_insert(PyBytesObject *self, PyObject *args) ...@@ -2313,7 +2313,7 @@ bytes_insert(PyBytesObject *self, PyObject *args)
} }
if (where > n) if (where > n)
where = n; where = n;
memmove(self->ob_bytes + where + 1, self->ob_bytes + where, n - where + 1); memmove(self->ob_bytes + where + 1, self->ob_bytes + where, n - where);
self->ob_bytes[where] = value; self->ob_bytes[where] = value;
Py_RETURN_NONE; Py_RETURN_NONE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment