summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-06-15 20:34:28 -0400
committerJune McEnroe <june@causal.agency>2020-06-15 20:34:28 -0400
commit82acea5dfa260fa7b4f6257f4502b9a9a2eeabaa (patch)
treedc3336244c4b46f357b896583f446c3ec883fefb
parentDocument /quote needing /debug for output (diff)
downloadcatgirl-82acea5dfa260fa7b4f6257f4502b9a9a2eeabaa.tar.gz
catgirl-82acea5dfa260fa7b4f6257f4502b9a9a2eeabaa.zip
Add null terminator to modes in channelListMode
Otherwise passing more than 13 parameters reads past the end of the
array.
Diffstat (limited to '')
-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);
 }