diff options
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 5771b6a..7fcbd2a 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -62,6 +62,7 @@ hid_t _sys_open(const char __user *path, long len, int flags) { if (flags & ~(OPEN_RW | OPEN_CREATE)) SYSCALL_RETURN(-ENOSYS); + static_assert(PATH_MAX <= KMALLOC_MAX); if (PATH_MAX < len) SYSCALL_RETURN(-ENAMETOOLONG); /* Doesn't check for free handles. Another thread could use up all @@ -461,7 +462,8 @@ hid_t _sys_getnull(int flags) { long _sys_execbuf(void __user *ubuf, size_t len) { if (len == 0) SYSCALL_RETURN(0); - if (len > EXECBUF_MAX_LEN) + static_assert(EXECBUF_MAX_LEN <= KMALLOC_MAX); + if (EXECBUF_MAX_LEN < len) SYSCALL_RETURN(-1); if (proc_cur->execbuf.buf) SYSCALL_RETURN(-1); |