summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2013-10-10 12:27:38 +0000
committernicm <nicm@openbsd.org>2013-10-10 12:27:38 +0000
commit197d2e58b1ce2028f7ca8c85696a9594af8d7b7c (patch)
tree22e32de88c774d72572a796878cd6f125cc73ec3 /usr.bin/tmux/server-client.c
parentAlter how tmux handles the working directory to internally use file (diff)
downloadwireguard-openbsd-197d2e58b1ce2028f7ca8c85696a9594af8d7b7c.tar.xz
wireguard-openbsd-197d2e58b1ce2028f7ca8c85696a9594af8d7b7c.zip
Don't look at string[length - 1] if length == 0.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 7426c9de375..00d6e9903b9 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.109 2013/10/10 12:26:36 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.110 2013/10/10 12:27:38 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -961,12 +961,12 @@ server_client_msg_identify(struct client *c, struct imsg *imsg)
c->flags |= flags;
break;
case MSG_IDENTIFY_TERM:
- if (data[datalen - 1] != '\0')
+ if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TERM string");
c->term = xstrdup(data);
break;
case MSG_IDENTIFY_TTYNAME:
- if (data[datalen - 1] != '\0')
+ if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TTYNAME string");
c->ttyname = xstrdup(data);
break;
@@ -981,7 +981,7 @@ server_client_msg_identify(struct client *c, struct imsg *imsg)
c->fd = imsg->fd;
break;
case MSG_IDENTIFY_ENVIRON:
- if (data[datalen - 1] != '\0')
+ if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_ENVIRON string");
if (strchr(data, '=') != NULL)
environ_put(&c->environ, data);