Add null terminator to modes in channelListMode

Otherwise passing more than 13 parameters reads past the end of the
array.
master
C. McEnroe 2020-06-15 20:34:28 -04:00
parent cabe285427
commit 82acea5dfa
1 changed files with 3 additions and 1 deletions

View File

@ -213,7 +213,9 @@ static void channelListMode(uint id, char pm, char l, const char *params) {
for (const char *ch = params; *ch; ++ch) { for (const char *ch = params; *ch; ++ch) {
if (*ch == ' ') count++; 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); ircFormat("MODE %s %c%.*s %s\r\n", idNames[id], pm, count, modes, params);
} }