diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -387,7 +387,7 @@ /* * How many bytes to copy */ - len = min(PAGE_SIZE - page_offset, uio->uio_resid); + len = MIN(PAGE_SIZE - page_offset, uio->uio_resid); /* * Fault and hold the page on behalf of the process. @@ -1382,6 +1382,10 @@ case PT_IO: piod = addr; + if (piod->piod_len > SSIZE_MAX) { + error = EINVAL; + goto out; + } iov.iov_base = piod->piod_addr; iov.iov_len = piod->piod_len; uio.uio_offset = (off_t)(uintptr_t)piod->piod_offs;