Mercurial > pidgin
comparison libpurple/protocols/sametime/sametime.c @ 18596:8261beed9653
Fixes Ticket #1707 Crash with invalid UTF-8 status message from other Sametime client
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 22 Jul 2007 00:25:56 +0000 |
parents | ab6d2763b8d8 |
children | b8cbc7659a5a 5734f1c98a37 |
comparison
equal
deleted
inserted
replaced
18595:f054b6fa9dfc | 18596:8261beed9653 |
---|---|
3187 | 3187 |
3188 gc = b->account->gc; | 3188 gc = b->account->gc; |
3189 pd = gc->proto_data; | 3189 pd = gc->proto_data; |
3190 | 3190 |
3191 ret = mwServiceAware_getText(pd->srvc_aware, &t); | 3191 ret = mwServiceAware_getText(pd->srvc_aware, &t); |
3192 return ret? g_markup_escape_text(ret, -1): NULL; | 3192 |
3193 return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; | |
3193 } | 3194 } |
3194 | 3195 |
3195 | 3196 |
3196 static const char *status_text(PurpleBuddy *b) { | 3197 static const char *status_text(PurpleBuddy *b) { |
3197 PurplePresence *presence; | 3198 PurplePresence *presence; |
3252 pd = gc->proto_data; | 3253 pd = gc->proto_data; |
3253 | 3254 |
3254 message = mwServiceAware_getText(pd->srvc_aware, &idb); | 3255 message = mwServiceAware_getText(pd->srvc_aware, &idb); |
3255 status = status_text(b); | 3256 status = status_text(b); |
3256 | 3257 |
3257 if(message != NULL && purple_utf8_strcasecmp(status, message)) { | 3258 if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) { |
3258 tmp = g_markup_escape_text(message, -1); | 3259 tmp = g_markup_escape_text(message, -1); |
3259 purple_notify_user_info_add_pair(user_info, status, tmp); | 3260 purple_notify_user_info_add_pair(user_info, status, tmp); |
3260 g_free(tmp); | 3261 g_free(tmp); |
3261 | 3262 |
3262 } else { | 3263 } else { |
4149 if(b) { | 4150 if(b) { |
4150 purple_notify_user_info_add_pair(user_info, _("Status"), status_text(b)); | 4151 purple_notify_user_info_add_pair(user_info, _("Status"), status_text(b)); |
4151 | 4152 |
4152 /* XXX Is this adding a status message in its own section rather than with the "Status" label? */ | 4153 /* XXX Is this adding a status message in its own section rather than with the "Status" label? */ |
4153 tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb); | 4154 tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb); |
4154 if(tmp2) { | 4155 if(tmp2 && g_utf8_validate(tmp2, -1, NULL)) { |
4155 tmp = g_markup_escape_text(tmp2, -1); | 4156 tmp = g_markup_escape_text(tmp2, -1); |
4156 purple_notify_user_info_add_section_break(user_info); | 4157 purple_notify_user_info_add_section_break(user_info); |
4157 purple_notify_user_info_add_pair(user_info, NULL, tmp); | 4158 purple_notify_user_info_add_pair(user_info, NULL, tmp); |
4158 g_free(tmp); | 4159 g_free(tmp); |
4159 } | 4160 } |