commit | 4f3be8a0a908784f4ab5fec66439643f2c1d79eb | [log] [tgz] |
---|---|---|
author | Neal Norwitz <nnorwitz@gmail.com> | Thu Jul 31 17:08:14 2008 +0000 |
committer | Neal Norwitz <nnorwitz@gmail.com> | Thu Jul 31 17:08:14 2008 +0000 |
tree | 0d7f0d95099fd0b5e93e2f994a3fc0db6b682b29 | |
parent | 83ac0144fa3041556aa4f3952ebd979e0189a19c [diff] [blame] |
Security patches from Apple: prevent int overflow when allocating memory
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 3565ab6..74b81da 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c
@@ -223,7 +223,7 @@ 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);