diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 2477ac12c..a638dbd15 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -30,6 +30,7 @@ Bug fixes:: * core: flush stdout/stderr before forking in hook_process function (issue #1441) * core: fix evaluation of condition with nested "if" (issue #1434) + * irc: fix crash when receiving a malformed message 324 (channel mode) * irc: add nick changes in the hotlist (except self nick change) * irc: case-insensitive comparison on incoming CTCP command, force upper case on CTCP replies (issue #1439) * irc: fix memory leak when the channel topic is changed diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c index 2237a344b..e79f0deb7 100644 --- a/src/plugins/irc/irc-mode.c +++ b/src/plugins/irc/irc-mode.c @@ -224,17 +224,20 @@ irc_mode_channel_update (struct t_irc_server *server, current_arg++; if (pos[0] == chanmode) { - chanmode_found = 1; - if (set_flag == '+') + if (!chanmode_found) { - str_mode[0] = pos[0]; - str_mode[1] = '\0'; - strcat (new_modes, str_mode); - if (argument) + chanmode_found = 1; + if (set_flag == '+') { - if (new_args[0]) - strcat (new_args, " "); - strcat (new_args, argument); + str_mode[0] = pos[0]; + str_mode[1] = '\0'; + strcat (new_modes, str_mode); + if (argument) + { + if (new_args[0]) + strcat (new_args, " "); + strcat (new_args, argument); + } } } }