luad

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit adf7f542bb09d6cb4fe4417ae97b50ae4f558b21
parent a820bbf9330bc46238b6d284a90e8ac88f9691de
Author: Daniel Barlow <dan@telent.net>
Date:   Tue, 26 May 2026 19:08:12 +0100

check for total fds passed inc. previous cmsgs

Diffstat:
Mluad.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/luad.c b/luad.c @@ -66,7 +66,7 @@ int * fds_from_msg(struct msghdr *msg, int * peer_fds) { if(cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { int passed_fd_count = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof (int); - if(i <= 3) { + if(i + passed_fd_count <= 3) { memcpy(&peer_fds[i], CMSG_DATA(cmsg), passed_fd_count * sizeof(int)); } else {