Merge pull request #738 from scumjr/master

irc: fix NULL pointer dereference in 734 command callback
This commit is contained in:
Sébastien Helleu 2016-08-02 18:29:12 +02:00 committed by GitHub
commit 24d9abf46d

View File

@ -5384,8 +5384,13 @@ IRC_PROTOCOL_CALLBACK(733)
IRC_PROTOCOL_CALLBACK(734) IRC_PROTOCOL_CALLBACK(734)
{ {
char *pos_args;
IRC_PROTOCOL_MIN_ARGS(5); IRC_PROTOCOL_MIN_ARGS(5);
pos_args = (argc > 5) ?
((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]) : NULL;
weechat_printf_date_tags ( weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer ( irc_msgbuffer_get_target_buffer (
server, NULL, command, "monitor", NULL), server, NULL, command, "monitor", NULL),
@ -5393,7 +5398,7 @@ IRC_PROTOCOL_CALLBACK(734)
irc_protocol_tags (command, "irc_numeric", NULL, NULL), irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s (%s)", "%s%s (%s)",
weechat_prefix ("error"), weechat_prefix ("error"),
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5], (pos_args && pos_args[0]) ? pos_args : "",
argv[3]); argv[3]);
return WEECHAT_RC_OK; return WEECHAT_RC_OK;