pidgin: 5c2dba4a: Fix a crash when remote users have certa...

markdoliner at pidgin.im markdoliner at pidgin.im
Sat Aug 20 13:05:58 EDT 2011


----------------------------------------------------------------------
Revision: 5c2dba4a7e2e76b76e7f472b88953a4316706d43
Parent:   5749f9193063800d27bef75c2388f6f9cc2f7f37
Author:   markdoliner at pidgin.im
Date:     08/18/11 04:41:24
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5c2dba4a7e2e76b76e7f472b88953a4316706d43

Changelog: 

Fix a crash when remote users have certain characters in their
nicknames. (Discovered by Djego Ibanez)
Fixes #14341

Changes against parent 5749f9193063800d27bef75c2388f6f9cc2f7f37

  patched  ChangeLog
  patched  libpurple/protocols/irc/msgs.c
  patched  libpurple/protocols/irc/parse.c

-------------- next part --------------
============================================================
--- ChangeLog	cfd4ee7497fe2661c7a270bf672faae943eeac0e
+++ ChangeLog	dad909df951e4b1fa589b904da36d0341f0340e7
@@ -35,6 +35,8 @@ version 2.10.0 (08/18/2011):
 	  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)
 
============================================================
--- libpurple/protocols/irc/msgs.c	0d5069b55dac6af2b9b74c8745963c2f96e8a7e0
+++ libpurple/protocols/irc/msgs.c	e3a01ebf143502b0ea9b59aa3c2294f818608ea5
@@ -409,14 +409,21 @@ void irc_msg_who(struct irc_conn *irc, c
 		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 @@ void irc_msg_who(struct irc_conn *irc, c
 		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);
============================================================
--- libpurple/protocols/irc/parse.c	cb07199db4b0ae11f0ab6317f0c1041026fa6386
+++ libpurple/protocols/irc/parse.c	2a9a5d6a67100220c2f4186e69e281f55a1f3f18
@@ -74,7 +74,7 @@ static struct _irc_msg {
 	{ "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			*/


More information about the Commits mailing list