mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
poll: add check for nfds
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user