summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-fn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-10-10 12:13:30 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-10-10 12:13:30 +0000
commit71eb50d651f99dfac1f294547feb09fb49be3b77 (patch)
tree03f5be05f345ca6ce4bf97fc6242ef475c076f88 /usr.bin/tmux/server-fn.c
parentda9d8bf012c94297f1eff04ef8883bd424ec1cff (diff)
Instead of fixed size buffers for some messages, send only the string
length.
Diffstat (limited to 'usr.bin/tmux/server-fn.c')
-rw-r--r--usr.bin/tmux/server-fn.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index 9b88f64830b..1f7bb859611 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.71 2013/10/10 11:46:28 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.72 2013/10/10 12:13:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -235,9 +235,8 @@ server_lock_session(struct session *s)
void
server_lock_client(struct client *c)
{
- const char *cmd;
- size_t cmdlen;
- struct msg_lock_data lockdata;
+ const char *cmd;
+ size_t cmdlen;
if (c->flags & CLIENT_CONTROL)
return;
@@ -246,8 +245,7 @@ server_lock_client(struct client *c)
return;
cmd = options_get_string(&c->session->options, "lock-command");
- cmdlen = strlcpy(lockdata.cmd, cmd, sizeof lockdata.cmd);
- if (cmdlen >= sizeof lockdata.cmd)
+ if (strlen(cmd) + 1 > MAX_IMSGSIZE - IMSG_HEADER_SIZE)
return;
tty_stop_tty(&c->tty);
@@ -256,7 +254,7 @@ server_lock_client(struct client *c)
tty_raw(&c->tty, tty_term_string(c->tty.term, TTYC_E3));
c->flags |= CLIENT_SUSPENDED;
- server_write_client(c, MSG_LOCK, &lockdata, sizeof lockdata);
+ server_write_client(c, MSG_LOCK, cmd, strlen(cmd) + 1);
}
void