pidgin: ea2f92f4: Fixes a bad MSN bug where passwords with...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Nov 4 13:47:36 EST 2009


-----------------------------------------------------------------
Revision: ea2f92f486297b27994d3652e14f799eb0964834
Ancestor: a83c5a439ea7250a77b9d56ccf0dd25cc3ec36d3
Author: markdoliner at pidgin.im
Date: 2009-11-04T18:41:21
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ea2f92f486297b27994d3652e14f799eb0964834

Modified files:
        COPYRIGHT ChangeLog libpurple/protocols/msn/nexus.c

ChangeLog: 

Fixes a bad MSN bug where passwords with multi-byte utf8 characters near
the 16 byte mark would cause a segmentation fault due to chopping the
multi-byte character and turning the string into invalidate utf8.

Thanks to Shaun Lindsay at Meebo for tracking this down and fixing it.

-------------- next part --------------
============================================================
--- COPYRIGHT	18e1886aa51978f4591de171084acd055c815b3d
+++ COPYRIGHT	2d7a93aa51ae94a610801315421149a2bec03b64
@@ -268,6 +268,7 @@ Wesley Lin
 Ambrose C. Li
 Nicolas Lichtmaier
 Wesley Lin
+Shaun Lindsay
 Artem Litvinovich
 Josh Littlefield
 Daniel Ljungborg
============================================================
--- ChangeLog	62ae72f47748eaa6e3fb1a5b9c0115efee13a829
+++ ChangeLog	7805112ca4187f7ad9fc7e11f3276de76ab080b0
@@ -14,6 +14,8 @@ version 2.6.4 (??/??/20??):
 	MSN:
 	* Don't forget display names for buddies.
 	* Fix a random crash that might occur when idle.
+	* Fix a crash when logging in with some long non-ASCII passwords.
+	  (Shaun Lindsay)
 
 	XMPP:
 	* Users connecting to Google Talk now have an "Initiate Chat" context menu
============================================================
--- libpurple/protocols/msn/nexus.c	9699ed5b1dd8bfa0931ecb5e9055862fdbc5d161
+++ libpurple/protocols/msn/nexus.c	c1025f88f89d669ed6d95b47cc1936cc42342593
@@ -399,7 +399,14 @@ msn_nexus_connect(MsnNexus *nexus)
 
 	username = purple_account_get_username(session->account);
 	password = purple_connection_get_password(session->account->gc);
-	password_xml = g_markup_escape_text(password, MIN(strlen(password), 16));
+	if (g_utf8_strlen(password, -1) > 16) {
+		/* max byte size for 16 utf8 characters is 64 + 1 for the null */
+		gchar truncated[65];
+		g_utf8_strncpy(truncated, password, 16);
+		password_xml = g_markup_escape_text(truncated, -1);
+	} else {
+		password_xml = g_markup_escape_text(password, -1);
+	}
 
 	purple_debug_info("msn", "Logging on %s, with policy '%s', nonce '%s'\n",
 	                  username, nexus->policy, nexus->nonce);


More information about the Commits mailing list