From 80e2b4e4d92badc9b4599d84f2d0f7eb9a305b46 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 17 Apr 2026 18:49:12 +1000 Subject: [PATCH] util: close excessive file descriptors in iobuf_recv_from_fd Unceremoneously close any fds that the client gives us that exceed our expectations (which right now is a max of 32 for a protocol-valid max of... 1). Assisted-by: Claude:claude-opus-4-6 Part-of: --- src/util-io.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util-io.c b/src/util-io.c index acc35f0..3315ab6 100644 --- a/src/util-io.c +++ b/src/util-io.c @@ -390,6 +390,12 @@ iobuf_recv_from_fd(struct iobuf *buf, int fd) fd++; } } + /* Close any remaining fds that didn't fit in the buffer + * to prevent fd leaks */ + while (*fd != -1) { + xclose(*fd); + fd++; + } } nread += rc;