mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-08 08:21:04 -04:00
protocol-native: check msg fds against available fds
Check that the number of fds for the message does not exceed the number of received fds with SCM_RIGHTS. The check was simply doing an array bounds check. This could still lead to out-of-sync fds or usage of uninitialized/invalid fds when the message header claims more fds than there were passed with SCM_RIGHTS. Found by Claude Code.
This commit is contained in:
parent
247918339e
commit
c9ecbf9fab
1 changed files with 1 additions and 1 deletions
|
|
@ -536,7 +536,7 @@ static int prepare_packet(struct pw_protocol_native_connection *conn, struct buf
|
|||
size -= impl->hdr_size;
|
||||
buf->msg.fds = &buf->fds[buf->fds_offset];
|
||||
|
||||
if (buf->msg.n_fds + buf->fds_offset > MAX_FDS)
|
||||
if (buf->msg.n_fds + buf->fds_offset > buf->n_fds)
|
||||
return -EPROTO;
|
||||
|
||||
if (size < len)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue