From bf3c8a194ca0cdc369d8c8e1fff2241347c172bd Mon Sep 17 00:00:00 2001 From: Mark Doliner Date: Tue, 6 Dec 2011 06:50:18 +0000 Subject: [PATCH] Fix another possible remote crash bug in SILC. This is the same change that Ethan made in 69372ee4f474efcca38b010bc2cdd61a917955f4, but to a different function. Refs #14636 --HG-- branch : release-2.x.y extra : convert_revision : afb9ede3de989f217f03d5670cca00e628bd11f1 --- libpurple/protocols/silc/ops.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libpurple/protocols/silc/ops.c b/libpurple/protocols/silc/ops.c index 60314c358a..ca57760862 100644 --- a/libpurple/protocols/silc/ops.c +++ b/libpurple/protocols/silc/ops.c @@ -332,10 +332,17 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, } 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); } } -- 2.11.4.GIT