* mmap.cc (mmap64): Avoid crash if file size is less than requested

map length.
This commit is contained in:
Corinna Vinschen
2003-08-15 12:05:08 +00:00
parent dae37d5d84
commit 92d897cde2
2 changed files with 6 additions and 1 deletions

View File

@@ -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");