From fa61982981ec7766663405cdfec9446e1f1673d4 Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Mon, 6 Oct 2025 12:52:38 -0300 Subject: [PATCH] Added safety check for poll(): the nsysnet fd must fit in nsysnet_fd_set. --- libraries/wutsocket/poll.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/wutsocket/poll.c b/libraries/wutsocket/poll.c index 27c2672e..20e88739 100644 --- a/libraries/wutsocket/poll.c +++ b/libraries/wutsocket/poll.c @@ -32,6 +32,10 @@ poll(struct pollfd *fds, if ((cnv_fd + 1) > cnv_nfds) { cnv_nfds = cnv_fd + 1; + if (cnv_nfds > NSYSNET_FD_SETSIZE) { + errno = EINVAL; + return -1; + } } if (fds[i].events & POLLIN) {