--- a/libpurple/protocols/mxit/markup.c Mon Jan 27 17:34:21 2014 +0530 +++ b/libpurple/protocols/mxit/markup.c Wed Jan 29 00:28:08 2014 +0530 @@ -204,7 +204,8 @@ */ static int asn_getUtf8( const gchar* data, gchar type, char** utf8 ) { - int len; + unsigned int len; + gchar *out_str; /* validate the field type [1 byte] */ if ( data[0] != type ) { @@ -213,10 +214,12 @@ return -1; } - len = data[1]; /* length field [1 bytes] */ - *utf8 = g_malloc( len + 1 ); - memcpy( *utf8, &data[2], len ); /* data field */ - (*utf8)[len] = '\0'; + len = (uint8_t)data[1]; /* length field [1 byte] */ + out_str = g_malloc(len + 1); + memcpy(out_str, &data[2], len); /* data field */ + out_str[len] = '\0'; + + *utf8 = out_str; return ( len + 2 ); }