From 82acea5dfa260fa7b4f6257f4502b9a9a2eeabaa Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Mon, 15 Jun 2020 20:34:28 -0400 Subject: Add null terminator to modes in channelListMode Otherwise passing more than 13 parameters reads past the end of the array. --- command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/command.c b/command.c index ee3801d..90732f3 100644 --- a/command.c +++ b/command.c @@ -213,7 +213,9 @@ static void channelListMode(uint id, char pm, char l, const char *params) { for (const char *ch = params; *ch; ++ch) { if (*ch == ' ') count++; } - char modes[ParamCap - 2] = { l, l, l, l, l, l, l, l, l, l, l, l, l }; + char modes[ParamCap - 2 + 1] = { + l, l, l, l, l, l, l, l, l, l, l, l, l, '\0' + }; ircFormat("MODE %s %c%.*s %s\r\n", idNames[id], pm, count, modes, params); } -- cgit 1.4.1-2-gfad0