summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/mmap.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-08-15 12:05:08 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-08-15 12:05:08 +0000
commit92d897cde2f0c2f9f006630d0461a54c784f83ab (patch)
tree7d8742c6025e14f96a244187d897143f88a894f1 /winsup/cygwin/mmap.cc
parentdae37d5d84858fbfe4a2bf7c02ebf1e0a9210225 (diff)
downloadcygnal-92d897cde2f0c2f9f006630d0461a54c784f83ab.tar.gz
cygnal-92d897cde2f0c2f9f006630d0461a54c784f83ab.tar.bz2
cygnal-92d897cde2f0c2f9f006630d0461a54c784f83ab.zip
* mmap.cc (mmap64): Avoid crash if file size is less than requested
map length.
Diffstat (limited to 'winsup/cygwin/mmap.cc')
-rw-r--r--winsup/cygwin/mmap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 7d8809e47..6af4946a7 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -600,7 +600,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, _off64_t off)
}
/* Insert into the list */
- mmap_record *rec = map_list->add_record (mmap_rec, off, len);
+ mmap_record *rec = map_list->add_record (mmap_rec, off, len > gran_len ? gran_len : len);
caddr_t ret = rec->get_address () + (off - gran_off);
syscall_printf ("%x = mmap() succeeded", ret);
ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");