qrexec-daemon: fix read underflow when the last fd goes

If no remaining fd is alive in the list, the loop breaks when i
is negative, but by then clients[-1] would have been dereferenced.
release2
Vincent Penquerc'h 11 years ago committed by Marek Marczykowski-Górecki
parent bac950c5ce
commit 771be64912

@ -246,7 +246,7 @@ void terminate_client_and_flush_data(int fd)
clients[fd].state = CLIENT_INVALID;
buffer_free(&clients[fd].buffer);
if (max_client_fd == fd) {
for (i = fd; clients[i].state == CLIENT_INVALID && i >= 0;
for (i = fd; i >= 0 && clients[i].state == CLIENT_INVALID;
i--);
max_client_fd = i;
}

Loading…
Cancel
Save