mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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:
parent
f072122c79
commit
39c6dea4a2
3 changed files with 52 additions and 4 deletions
|
|
@ -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 *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue