pidgin.2.x.y: afb9ede3: Fix another possible remote crash bug in...

markdoliner at pidgin.im markdoliner at pidgin.im
Sat Dec 10 15:01:09 EST 2011


----------------------------------------------------------------------
Revision: afb9ede3de989f217f03d5670cca00e628bd11f1
Parent:   c7b95cc3be0590b52edc02d4750ae62844c1acb6
Author:   markdoliner at pidgin.im
Date:     12/06/11 01:50:18
Branch:   im.pidgin.pidgin.2.x.y
URL: http://d.pidgin.im/viewmtn/revision/info/afb9ede3de989f217f03d5670cca00e628bd11f1

Changelog: 

Fix another possible remote crash bug in SILC.

This is the same change that Ethan made in 7eb1f6d56cc58bbb5b56b7df53955d36b9b419b8,
but to a different function.  Refs #14636

Changes against parent c7b95cc3be0590b52edc02d4750ae62844c1acb6

  patched  libpurple/protocols/silc/ops.c

-------------- next part --------------
============================================================
--- libpurple/protocols/silc/ops.c	80bd9a7d3faf9e5ef28438647159fe19847e9839
+++ libpurple/protocols/silc/ops.c	e828291021afbdd6e6370738aa6224788bf885a3
@@ -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);
 	}
 }


More information about the Commits mailing list