1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-03 16:43:12 +02:00

Add some comments and add a redundant check for parameter writing.

Better to be safe than to accidentally write OOB.
This commit is contained in:
Bram Matthys
2021-08-22 19:43:36 +02:00
parent 49955670d9
commit 58cd2d8bfd
+14
View File
@@ -607,8 +607,22 @@ char *mode_ban_handler(Client *client, Channel *channel, char *param, int what,
return tmpstr;
}
/** Write the result of a mode change.
* This is used by do_mode_char_list_mode(), do_mode_char_member_mode()
* and do_extmode_char().
* The result is later used by make_mode_str() to create the
* actual MODE line to be broadcasted to the channel and other servers.
*/
void do_mode_char_write(char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], u_int *pcount, u_int what, char modeletter, char *str)
{
/* Caller should have made sure there was room! */
if (*pcount >= MAXMODEPARAMS)
#ifdef DEBUGMODE
abort();
#else
return 0;
#endif
ircsnprintf(pvar[*pcount], MODEBUFLEN + 3,
"%c%c%s",
(what == MODE_ADD) ? '+' : '-',