/pidgin/main: 8172584fd640: Fix for TALOS-CAN-0123

Andrew Victor andrew.victor at mxit.com
Mon Jun 20 20:09:57 EDT 2016


Changeset: 8172584fd6409f72f7799afad5c0cf55c43a5b08
Author:	 Andrew Victor <andrew.victor at mxit.com>
Date:	 2016-06-02 16:04 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/8172584fd640

Description:

Fix for TALOS-CAN-0123

diffstat:

 libpurple/protocols/mxit/markup.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (36 lines):

diff --git a/libpurple/protocols/mxit/markup.c b/libpurple/protocols/mxit/markup.c
--- a/libpurple/protocols/mxit/markup.c
+++ b/libpurple/protocols/mxit/markup.c
@@ -1083,7 +1083,6 @@ char* mxit_convert_markup_tx( const char
 	GList*				entry;
 	GList*				tagstack	= NULL;
 	char*				reply;
-	char				color[8];
 	int					len			= strlen ( message );
 	int					i;
 
@@ -1145,12 +1144,18 @@ char* mxit_convert_markup_tx( const char
 				}
 				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 */



More information about the Commits mailing list