summary refs log tree commit diff
diff options
context:
space:
mode:
authorC. McEnroe2020-06-15 20:34:28 -0400
committerC. McEnroe2020-06-15 20:34:28 -0400
commit82acea5dfa260fa7b4f6257f4502b9a9a2eeabaa (patch)
treedc3336244c4b46f357b896583f446c3ec883fefb
parentcabe285427f7c122892c1ca09b3ac9ca0213c5d2 (diff)
Add null terminator to modes in channelListMode
Otherwise passing more than 13 parameters reads past the end of the
array.
-rw-r--r--command.c4
1 files changed, 3 insertions, 1 deletions
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);
 }