summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-02-08 20:24:50 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-02-08 20:24:50 +0100
commit6f4f147d8e86adf9ad34a8ffd7e7f1f23a7e74da (patch)
treec8522138ab6e91d0cf9609ef6a12e1c43aefe6d8 /src
parent39f2591cf5fa20b9369f15368d314b1410188ac8 (diff)
downloadweechat-6f4f147d8e86adf9ad34a8ffd7e7f1f23a7e74da.zip
irc: fix crash when receiving a malformed message 324 (channel mode)
Thanks to Stuart Nevans Locke for reporting the issue.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-mode.c21
1 files changed, 12 insertions, 9 deletions
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);
+ }
}
}
}