diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-07-31 17:17:14 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-07-31 17:17:14 (GMT) |
commit | e7d8be80ba634fa15ece6f503c33592e0d333361 (patch) | |
tree | 4264163ebdcea24504f3842330602d98301cf659 /Modules/mmapmodule.c | |
parent | e70f8e1205b5fc60a30469db69bbee4d5d532d86 (diff) | |
download | cpython-e7d8be80ba634fa15ece6f503c33592e0d333361.zip cpython-e7d8be80ba634fa15ece6f503c33592e0d333361.tar.gz cpython-e7d8be80ba634fa15ece6f503c33592e0d333361.tar.bz2 |
Security patches from Apple: prevent int overflow when allocating memory
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 c71d840..08b5a96 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -239,7 +239,7 @@ mmap_read_method(mmap_object *self, return(NULL); /* silently 'adjust' out-of-range requests */ - if ((self->pos + num_bytes) > self->size) { + if (num_bytes > self->size - self->pos) { num_bytes -= (self->pos+num_bytes) - self->size; } result = Py_BuildValue("s#", self->data+self->pos, num_bytes); |