From 786443f9f4b28c80e501b1a6cf62e28383f65ebe Mon Sep 17 00:00:00 2001 From: halbeno Date: Tue, 22 May 2018 17:03:27 -0600 Subject: [PATCH] Check input string length before reading third byte (for input strings of '\n' and '/\n') --- ii.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ii.c b/ii.c index fc02d7f..ad59064 100644 --- a/ii.c +++ b/ii.c @@ -463,9 +463,11 @@ proc_channels_input(int ircfd, Channel *c, char *buf) proc_channels_privmsg(ircfd, c, buf); return; } + buflen = strlen(buf); + if (buflen < 2) + return; msg[0] = '\0'; if (buf[2] == ' ' || buf[2] == '\0') { - buflen = strlen(buf); switch (buf[1]) { case 'j': /* join */ if ((p = strchr(&buf[3], ' '))) /* password parameter */ -- 2.17.0