Merged revisions 70052 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70052 | hirokazu.yamamoto | 2009-02-28 19:31:54 +0900 | 2 lines

  Issue #5386: mmap.write_byte didn't check map size, so it could cause buffer
  overrun.
........
This commit is contained in:
Hirokazu Yamamoto 2009-02-28 10:56:50 +00:00
parent f072122c79
commit 39c6dea4a2
3 changed files with 52 additions and 4 deletions

View file

@ -376,10 +376,17 @@ mmap_write_byte_method(mmap_object *self,
if (!is_writable(self))
return NULL;
*(self->data+self->pos) = value;
self->pos += 1;
Py_INCREF(Py_None);
return Py_None;
if (self->pos < self->size) {
*(self->data+self->pos) = value;
self->pos += 1;
Py_INCREF(Py_None);
return Py_None;
}
else {
PyErr_SetString(PyExc_ValueError, "write byte out of range");
return NULL;
}
}
static PyObject *