mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-15 10:28:09 +02:00
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: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/388>
This commit is contained in:
parent
f63b44d8ae
commit
80e2b4e4d9
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue