diff options
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r-- | Modules/mmapmodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 8a227527a5..ef026b260f 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1116,7 +1116,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) # endif if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) { if (map_size == 0) { - map_size = st.st_size; + map_size = st.st_size - offset; } else if ((size_t)offset + (size_t)map_size > st.st_size) { PyErr_SetString(PyExc_ValueError, "mmap length is greater than file size"); |