# HG changeset patch # User Sean Egan # Date 1185063956 0 # Node ID 8261beed965369f97c6e4b3ab8ac2275493d9128 # Parent f054b6fa9dfcb986aa38483e8c4f68d5ce74005c Fixes Ticket #1707 Crash with invalid UTF-8 status message from other Sametime client diff -r f054b6fa9dfc -r 8261beed9653 libpurple/protocols/sametime/sametime.c --- a/libpurple/protocols/sametime/sametime.c Sat Jul 21 23:30:59 2007 +0000 +++ b/libpurple/protocols/sametime/sametime.c Sun Jul 22 00:25:56 2007 +0000 @@ -3189,7 +3189,8 @@ pd = gc->proto_data; ret = mwServiceAware_getText(pd->srvc_aware, &t); - return ret? g_markup_escape_text(ret, -1): NULL; + + return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; } @@ -3254,7 +3255,7 @@ message = mwServiceAware_getText(pd->srvc_aware, &idb); status = status_text(b); - if(message != NULL && purple_utf8_strcasecmp(status, message)) { + if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) { tmp = g_markup_escape_text(message, -1); purple_notify_user_info_add_pair(user_info, status, tmp); g_free(tmp); @@ -4151,7 +4152,7 @@ /* XXX Is this adding a status message in its own section rather than with the "Status" label? */ tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb); - if(tmp2) { + if(tmp2 && g_utf8_validate(tmp2, -1, NULL)) { tmp = g_markup_escape_text(tmp2, -1); purple_notify_user_info_add_section_break(user_info); purple_notify_user_info_add_pair(user_info, NULL, tmp);