From b8b85fbb0c6cf4e9a3fa650ec7dc5036a1b0b01a Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 10 Oct 2013 12:27:38 +0000 Subject: Don't look at string[length - 1] if length == 0. --- client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 82e43992..e1bd47c2 100644 --- a/client.c +++ b/client.c @@ -575,7 +575,7 @@ client_dispatch_wait(void *data0) imsg_free(&imsg); return (-1); case MSG_SHELL: - if (data[datalen - 1] != '\0') + if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_SHELL string"); clear_signals(0); @@ -659,7 +659,7 @@ client_dispatch_attached(void) kill(getpid(), SIGTSTP); break; case MSG_LOCK: - if (data[datalen - 1] != '\0') + if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_LOCK string"); system(data); -- cgit v1.2.3