$OpenBSD: patch-Modules_mmapmodule_c,v 1.1 2008/08/06 03:23:31 djm Exp $ --- Modules/mmapmodule.c.orig Tue Aug 22 23:57:07 2006 +++ Modules/mmapmodule.c Tue Aug 5 18:18:52 2008 @@ -223,7 +223,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);