Mercurial > pidgin
changeset 31820:d2eb28c12d44
Fix a crash when remote users have certain characters in their
nicknames. (Discovered by Djego Ibanez)
Fixes #14341
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 18 Aug 2011 08:41:24 +0000 |
parents | 70ff869a74d1 |
children | b6955681b7b3 |
files | ChangeLog libpurple/protocols/irc/msgs.c libpurple/protocols/irc/parse.c |
diffstat | 3 files changed, 23 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Aug 18 08:38:23 2011 +0000 +++ b/ChangeLog Thu Aug 18 08:41:24 2011 +0000 @@ -35,6 +35,8 @@ ICQ account that is configured as an AIM account. (#14437) IRC: + * Fix a crash when remote users have certain characters in their + nicknames. (Discovered by Djego Ibanez) (#14341) * Fix the handling of formatting following mIRC ^O (#14436) * Fix crash when NAMES is empty. (James McLaughlin) (#14518)
--- a/libpurple/protocols/irc/msgs.c Thu Aug 18 08:38:23 2011 +0000 +++ b/libpurple/protocols/irc/msgs.c Thu Aug 18 08:41:24 2011 +0000 @@ -409,14 +409,21 @@ PurpleConvChat *chat; PurpleConvChatBuddy *cb; - char *userhost, *realname; + char *cur, *userhost, *realname; PurpleConvChatBuddyFlags flags; GList *keys = NULL, *values = NULL; - + + if (!args || !args[0] || !args[1] || !args[2] || !args[3] + || !args[4] || !args[5] || !args[6] || !args[7]) { + purple_debug(PURPLE_DEBUG_ERROR, "irc", + "Got a WHO response with not enough arguments\n"); + return; + } + conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); if (!conv) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a WHO response for %s, which doesn't exist\n", args[1]); + purple_debug(PURPLE_DEBUG_ERROR, "irc","Got a WHO response for %s, which doesn't exist\n", args[1]); return; } @@ -429,7 +436,16 @@ chat = PURPLE_CONV_CHAT(conv); userhost = g_strdup_printf("%s@%s", args[2], args[3]); - realname = g_strdup(args[8]); + + /* The final argument is a :-argument, but annoyingly + * contains two "words", the hop count and real name. */ + for (cur = args[7]; *cur; cur++) { + if (*cur == ' ') { + cur++; + break; + } + } + realname = g_strdup(cur); keys = g_list_prepend(keys, "userhost"); values = g_list_prepend(values, userhost);
--- a/libpurple/protocols/irc/parse.c Thu Aug 18 08:38:23 2011 +0000 +++ b/libpurple/protocols/irc/parse.c Thu Aug 18 08:41:24 2011 +0000 @@ -74,7 +74,7 @@ { "331", "nc:", irc_msg_topic }, /* No channel topic */ { "332", "nc:", irc_msg_topic }, /* Channel topic */ { "333", "*", irc_msg_ignore }, /* Topic setter stuff */ - { "352", "nvcvnvvv:", irc_msg_who },/* Channel WHO */ + { "352", "ncvvvnv:", irc_msg_who }, /* Channel WHO */ { "353", "nvc:", irc_msg_names }, /* Names list */ { "366", "nc:", irc_msg_names }, /* End of names */ { "367", "ncnnv", irc_msg_ban }, /* Ban list */