diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-28 11:39:24 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-28 11:39:24 +0100 |
commit | 6ea8c2d83cc8ad6af376e7a87b784d6708ef2f22 (patch) | |
tree | 0e2f8a2f2761b8950afa2c5e9aedbba03e53c953 /src/plugins | |
parent | 7213fe58261bd8c8eab253ab2be2285b59d33f8f (diff) | |
download | weechat-6ea8c2d83cc8ad6af376e7a87b784d6708ef2f22.zip |
irc: fix some malloc sizes
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-command.c | 4 | ||||
-rw-r--r-- | src/plugins/irc/irc-completion.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 3adfc4654..2395639f0 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -2475,8 +2475,8 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc, /* set ban for nick(+host) on channel */ if (strchr (pos_nick, '@')) { - length = strlen (pos_nick) + 16; - mask = malloc (length + 1); + length = strlen (pos_nick) + 16 + 1; + mask = malloc (length); if (mask) { pos = strchr (pos_nick, '!'); diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index f37c8f558..f667f1b9a 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -431,8 +431,8 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item, * instead of * /topic #test is a test channel */ - length = strlen (ptr_channel->name) + strlen (ptr_channel->topic) + 16; - topic = malloc (length + 1); + length = strlen (ptr_channel->name) + strlen (ptr_channel->topic) + 16 + 1; + topic = malloc (length); if (topic) { snprintf (topic, length, "%s %s", |