Skip to content

Commit

Permalink
daemon/ipc: Fix bug resulting in wrong FDs being closed
Browse files Browse the repository at this point in the history
If fewer than IPC_FD_MAX fds are passed in an IPC message, ipc.c
will incorrectly call close() on uninitialized memory which sometimes
results in other random fds being closed.
  • Loading branch information
shawnanastasio committed Apr 7, 2021
1 parent 9d27d47 commit 8855a56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion daemon/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ static void *server_receiver_thread(void *data_) {

// Close fds now that we're done forwarding them
if (fds) {
for (uint8_t i=0; i<IPC_FD_MAX; i++) {
for (uint8_t i=0; i<msg.fd_count; i++) {
if (fds[i] != -1)
close(fds[i]);
}
Expand Down

0 comments on commit 8855a56

Please sign in to comment.