# HG changeset patch # User Mark Doliner # Date 1323154218 0 # Node ID dd84029b4d0383c6153ba9fff909881d3eab6eef # Parent 9c9df712b19135eb3e40772df5e16c3f3c8df020 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 diff -r 9c9df712b191 -r dd84029b4d03 libpurple/protocols/silc/ops.c --- a/libpurple/protocols/silc/ops.c Tue Dec 06 06:47:37 2011 +0000 +++ b/libpurple/protocols/silc/ops.c Tue Dec 06 06:50:18 2011 +0000 @@ -332,10 +332,17 @@ } 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); } }