The server automatically accepts any fds the client sends (stdin and
(recently) cwd). However, when a client indicates a different
protocol version the server does not bother to keep track of the
fds, but also does not close them.

Immediately close any fds passed by clients advertising an
incompatible protocol version.
---
 server-client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server-client.c b/server-client.c
index aceef6e..cc18a96 100644
--- a/server-client.c
+++ b/server-client.c
@@ -808,6 +808,8 @@ server_client_msg_dispatch(struct client *c)
                if (imsg.hdr.peerid != PROTOCOL_VERSION) {
                        server_write_client(c, MSG_VERSION, NULL, 0);
                        c->flags |= CLIENT_BAD;
+                       if (imsg.fd != -1)
+                               close(imsg.fd);
                        imsg_free(&imsg);
                        continue;
                }
-- 
1.8.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to