pidgin/pidgin

Fix for TALOS-CAN-0123
release-2.x.y
2016-06-02, Andrew Victor
8172584fd640
Parents 5e5e84e8a798
Children 270d6da5520e
Fix for TALOS-CAN-0123
--- a/libpurple/protocols/mxit/markup.c Sun May 15 05:41:39 2016 -0300
+++ b/libpurple/protocols/mxit/markup.c Thu Jun 02 16:04:59 2016 -0500
@@ -1083,7 +1083,6 @@
GList* entry;
GList* tagstack = NULL;
char* reply;
- char color[8];
int len = strlen ( message );
int i;
@@ -1145,12 +1144,18 @@
}
else if ( purple_str_has_prefix( &message[i], "<font color=" ) ) {
/* font colour */
- tag = g_new0( struct tag, 1 );
- tag->type = MXIT_TAG_COLOR;
- tagstack = g_list_append( tagstack, tag );
- memset( color, 0x00, sizeof( color ) );
- memcpy( color, &message[i + 13], 7 );
- g_string_append( mx, color );
+ char color[8];
+
+ /* ensure we have the complete tag: <font color="#123456"> */
+ if ( i + 20 < len ) {
+ tag = g_new0( struct tag, 1 );
+ tag->type = MXIT_TAG_COLOR;
+ tagstack = g_list_append( tagstack, tag );
+
+ memset( color, 0x00, sizeof( color ) );
+ memcpy( color, &message[i + 13], 7 );
+ g_string_append( mx, color );
+ }
}
else if ( purple_str_has_prefix( &message[i], "</font>" ) ) {
/* end of font tag */