Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9e7d2f4ac8cc09d3a5d0312d619be54c > files > 8

pidgin-2.6.6-11.el5.4.src.rpm

diff -up pidgin-2.6.6/libpurple/protocols/silc/ops.c.CVE-2011-4603 pidgin-2.6.6/libpurple/protocols/silc/ops.c
--- pidgin-2.6.6/libpurple/protocols/silc/ops.c.CVE-2011-4603	2011-12-12 08:44:11.195882678 -0500
+++ pidgin-2.6.6/libpurple/protocols/silc/ops.c	2011-12-12 10:49:00.152945868 -0500
@@ -332,10 +332,17 @@ silc_channel_message(SilcClient client, 
 	}
 
 	if (flags & SILC_MESSAGE_FLAG_UTF8) {
-		tmp = g_markup_escape_text((const char *)message, -1);
+		const char *msg = (const char *)message;
+		char *salvaged = NULL;
+		if (!g_utf8_validate((const char *)message, -1, NULL)) {
+			salvaged = purple_utf8_salvage((const char *)message);
+			msg = salvaged;
+		}
+		tmp = g_markup_escape_text(msg, -1);
 		/* Send to Purple */
 		serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)),
 				 sender->nickname, 0, tmp, time(NULL));
+		g_free(salvaged);
 		g_free(tmp);
 	}
 }