Mercurial > pidgin
changeset 32378:dd84029b4d03
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
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 06 Dec 2011 06:50:18 +0000 |
parents | 9c9df712b191 |
children | 76b7754ba906 |
files | libpurple/protocols/silc/ops.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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); } }