pidgin.2.x.y: 0c3ef838: Fix a leak in IRC when accepting a UTF-8...

elb at pidgin.im elb at pidgin.im
Mon Nov 28 23:07:21 EST 2011


----------------------------------------------------------------------
Revision: 0c3ef8388ce0f274d695767f513518b859889979
Parent:   0ba3afb8adb303a77581a7872d674c600979a5a6
Author:   elb at pidgin.im
Date:     11/28/11 22:58:50
Branch:   im.pidgin.pidgin.2.x.y
URL: http://d.pidgin.im/viewmtn/revision/info/0c3ef8388ce0f274d695767f513518b859889979

Changelog: 

Fix a leak in IRC when accepting a UTF-8 message with a non-UTF-8 encoding.

Fixes #14700

Changes against parent 0ba3afb8adb303a77581a7872d674c600979a5a6

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

-------------- next part --------------
============================================================
--- ChangeLog	2c076008aac70940e2de7682106e6b8bc7d6df9b
+++ ChangeLog	d08cc16922cc18fdc5b32f1e9d7318cb10b53a5f
@@ -7,6 +7,10 @@ version 2.10.1 (10/11/2011):
 	Gadu-Gadu:
 	* Fix problems linking against GnuTLS. (#14544)
 
+	IRC:
+	* Fix a leak when admitting UTF-8 text with a non-UTF-8 primary
+	  encoding.  (#14700)
+
 	Sametime:
 	* Separate "username" and "server" when adding new Sametime accounts.
 	  (#14608)
============================================================
--- libpurple/protocols/irc/parse.c	42517267d9ee9cffb32fb9294d146f68c775832c
+++ libpurple/protocols/irc/parse.c	2caeec44270586298bf3b2cc38cd93baa8fe9846
@@ -260,6 +260,12 @@ static char *irc_recv_convert(struct irc
 	gboolean autodetect;
 	int i;
 
+	autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT);
+
+	if (autodetect && g_utf8_validate(string, -1, NULL)) {
+		return g_strdup(string);
+	}
+
 	enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET);
 	encodings = g_strsplit(enclist, ",", -1);
 
@@ -268,12 +274,6 @@ static char *irc_recv_convert(struct irc
 		return purple_utf8_salvage(string);
 	}
 
-	autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT);
-
-	if (autodetect && g_utf8_validate(string, -1, NULL)) {
-		return g_strdup(string);
-	}
-
 	for (i = 0; encodings[i] != NULL; i++) {
 		charset = encodings[i];
 		while (*charset == ' ')


More information about the Commits mailing list