]> granicus.if.org Git - python/commitdiff
Fix off-by-one bug in memmove() call in bytes_insert().
authorGuido van Rossum <guido@python.org>
Tue, 27 Feb 2007 20:57:45 +0000 (20:57 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 27 Feb 2007 20:57:45 +0000 (20:57 +0000)
Fix by Pete Shinners (for his own bug :-).

Objects/bytesobject.c

index f7de8bdd867990aca01c92501d96a9e2bfedd959..f07130d809d340da6573858032a3abbd5b8b7f52 100644 (file)
@@ -2313,7 +2313,7 @@ bytes_insert(PyBytesObject *self, PyObject *args)
     }
     if (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;
 
     Py_RETURN_NONE;