diff --git a/src/util-io.c b/src/util-io.c index f3f7af8..acc35f0 100644 --- a/src/util-io.c +++ b/src/util-io.c @@ -88,6 +88,11 @@ xsend_with_fd(int fd, const void *buf, size_t len, int *fds) if (nfds == 0) return xsend(fd, buf, len); + const size_t MAX_FDS = 32; + if (nfds > MAX_FDS) { + return -EINVAL; + } + char control[CMSG_SPACE(nfds * sizeof(int))]; struct cmsghdr *header = (struct cmsghdr *)control;