pidgin: 4f30170c: Use MIN(strlen(password), 16) for MSN be...

qulogic at pidgin.im qulogic at pidgin.im
Tue Aug 12 00:57:09 EDT 2008


-----------------------------------------------------------------
Revision: 4f30170cef563ecf059bc5e798c3bd75d01247e7
Ancestor: d9391a826c036d137ff644618c9858a60f7a0192
Author: qulogic at pidgin.im
Date: 2008-08-10T22:08:39
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4f30170cef563ecf059bc5e798c3bd75d01247e7

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

ChangeLog: 

Use MIN(strlen(password), 16) for MSN because g_markup_escape_text will 
try to use all 16 bytes instead of stopping at NUL termination.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/nexus.c	01645981157b953780ce1b7105aae7b99ee9840e
+++ libpurple/protocols/msn/nexus.c	d2d43d8ec8a6681ce0088b194d5cc1c9040b2b78
@@ -379,7 +379,8 @@ msn_nexus_connect(MsnNexus *nexus)
 {
 	MsnSession *session = nexus->session;
 	const char *username;
-	char *password;
+	const char *password;
+	char *password_xml;
 	GString *domains;
 	char *request;
 	int i;
@@ -390,7 +391,8 @@ msn_nexus_connect(MsnNexus *nexus)
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE);
 
 	username = purple_account_get_username(session->account);
-	password = g_markup_escape_text(purple_connection_get_password(session->account->gc), 16);
+	password = purple_connection_get_password(session->account->gc);
+	password_xml = g_markup_escape_text(password, MIN(strlen(password), 16));
 
 	purple_debug_info("msn", "Logging on %s, with policy '%s', nonce '%s'\n",
 	                  username, nexus->policy, nexus->nonce);
@@ -405,8 +407,8 @@ msn_nexus_connect(MsnNexus *nexus)
 		                           nexus->policy);
 	}
 
-	request = g_strdup_printf(MSN_SSO_TEMPLATE, username, password, domains->str);
-	g_free(password);
+	request = g_strdup_printf(MSN_SSO_TEMPLATE, username, password_xml, domains->str);
+	g_free(password_xml);
 	g_string_free(domains, TRUE);
 
 	soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1));


More information about the Commits mailing list