poll: add check for nfds

This commit is contained in:
Matheus
2026-04-01 16:51:12 -03:00
parent c46634fb07
commit e294f9814c
+5
View File
@@ -16,6 +16,11 @@ syscallret_t syscall_poll(context_t *, pollfd_t *fds, size_t nfds, int timeoutms
.ret = -1 .ret = -1
}; };
if (nfds > FDTABLE_LIMIT) {
ret.errno = EINVAL;
return ret;
}
size_t fdsbuffsize = nfds * sizeof(pollfd_t); size_t fdsbuffsize = nfds * sizeof(pollfd_t);
pollfd_t *fdsbuff = alloc(fdsbuffsize); pollfd_t *fdsbuff = alloc(fdsbuffsize);
if (fdsbuff == NULL) { if (fdsbuff == NULL) {