diff --git a/src/mman/mmap.c b/src/mman/mmap.c index eff88d82a8fcff843247a5436f42016690daac24..763c248cdba94b761753dae29b67b25890930b51 100644 --- a/src/mman/mmap.c +++ b/src/mman/mmap.c @@ -22,6 +22,10 @@ void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off) errno = ENOMEM; return MAP_FAILED; } + if (len == 0) { + errno = EINVAL; + return MAP_FAILED; + } if (flags & MAP_FIXED) { __vm_wait(); }