pidgin: 4f0c3aed: Don't try to convert the message in inco...

markdoliner at pidgin.im markdoliner at pidgin.im
Thu Mar 18 04:36:40 EDT 2010


-----------------------------------------------------------------
Revision: 4f0c3aedc3b013ab2175e57b71bab92988e4f812
Ancestor: 0ec011efe002bcfa6914018714ab395e7ad42e52
Author: markdoliner at pidgin.im
Date: 2010-03-18T08:30:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4f0c3aedc3b013ab2175e57b71bab92988e4f812

Modified files:
        libpurple/protocols/oscar/oscar.c

ChangeLog: 

Don't try to convert the message in incoming auth requests.  The oscar
protocol documentation that used to be posted on AOL's web site stated
that, "All strings in Feedbag are UTF8 encoded."  Looks like the current
conversion code was added in revision a59a61f8b5d0874acb16f9ca8e57a074cf037eca

I believe this fixes #7457

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	cb94f4738fb9d8e58b6f557716d8a158dc2459d6
+++ libpurple/protocols/oscar/oscar.c	759a5050ec50a7e7092b20520b52251646d97dd6
@@ -5807,28 +5807,34 @@ static int purple_ssi_authgiven(OscarDat
 	return 1;
 }
 
-static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
+static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...)
+{
 	PurpleConnection *gc = od->gc;
 	va_list ap;
-	char *bn;
-	char *msg;
+	const char *bn;
+	const char *msg;
 	PurpleAccount *account = purple_connection_get_account(gc);
-	gchar *reason = NULL;
 	struct name_data *data;
 	PurpleBuddy *buddy;
 
 	va_start(ap, fr);
-	bn = va_arg(ap, char *);
-	msg = va_arg(ap, char *);
+	bn = va_arg(ap, const char *);
+	msg = va_arg(ap, const char *);
 	va_end(ap);
 
 	purple_debug_info("oscar",
-			   "ssi: received authorization request from %s\n", bn);
+			"ssi: received authorization request from %s\n", bn);
 
 	buddy = purple_find_buddy(account, bn);
 
-	if (msg != NULL)
-		reason = purple_plugin_oscar_decode_im_part(account, bn, AIM_CHARSET_LATIN_1, 0x0000, msg, strlen(msg));
+	if (!msg) {
+		purple_debug_warning("oscar", "Received auth request from %s with "
+				"empty message\n", bn);
+	} else if (!g_utf8_validate(msg, -1, NULL)) {
+		purple_debug_warning("oscar", "Received auth request from %s with "
+				"invalid UTF-8 message\n", bn);
+		msg = NULL;
+	}
 
 	data = g_new(struct name_data, 1);
 	data->gc = gc;
@@ -5837,9 +5843,8 @@ static int purple_ssi_authrequest(OscarD
 
 	purple_account_request_authorization(account, bn, NULL,
 			(buddy ? purple_buddy_get_alias_only(buddy) : NULL),
-			reason, buddy != NULL, purple_auth_grant,
+			msg, buddy != NULL, purple_auth_grant,
 			purple_auth_dontgrant_msgprompt, data);
-	g_free(reason);
 
 	return 1;
 }


More information about the Commits mailing list