summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-10-26 20:47:00 +0000
committernicm <nicm@openbsd.org>2009-10-26 20:47:00 +0000
commitd6da136841779b79c4eea1ed885f531b1b5f586a (patch)
tree8d1f582bc638d086c92201c6fd177703464a8e38
parentLoad %mxcsr when initializing the FPU on machines that support SSE. (diff)
downloadwireguard-openbsd-d6da136841779b79c4eea1ed885f531b1b5f586a.tar.xz
wireguard-openbsd-d6da136841779b79c4eea1ed885f531b1b5f586a.zip
Don't do anything in the client callback if the client has already died to
avoid a use-after-free (the callback is used twice, once for the client itself and once for the tty). Fixes crashes seen by Han Boetes.
-rw-r--r--usr.bin/tmux/server-client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 3560db68f2c..1cbdb9680a7 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.6 2009/10/25 22:00:15 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.7 2009/10/26 20:47:00 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -153,6 +153,9 @@ server_client_callback(int fd, int events, void *data)
{
struct client *c = data;
+ if (c->flags & CLIENT_DEAD)
+ return;
+
if (fd == c->ibuf.fd) {
if (events & (POLLERR|POLLNVAL|POLLHUP))
goto client_lost;