aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-28 23:06:41 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-28 23:06:41 +0000
commit876ded6dfe560277d7771ba5a14964700ca8ad2a (patch)
tree15338076f5b29da5d2ce806c5a17cb4a776f8f28 /server-client.c
parent5a4ba7629392829b5139bd39ebf374c45fb364ee (diff)
downloadrtmux-876ded6dfe560277d7771ba5a14964700ca8ad2a.tar.gz
rtmux-876ded6dfe560277d7771ba5a14964700ca8ad2a.tar.bz2
rtmux-876ded6dfe560277d7771ba5a14964700ca8ad2a.zip
Sync OpenBSD patchset 462:
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.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/server-client.c b/server-client.c
index 0d10eb4b..dcfa7d4f 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c,v 1.7 2009-10-28 22:50:24 tcunha Exp $ */
+/* $Id: server-client.c,v 1.8 2009-10-28 23:06:41 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -152,6 +152,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;