libpurple/protocols/mxit/markup.c

branch
soc.2013.gobjectification.plugins
changeset 37016
48f85579cc4c
parent 36542
30f40ecc4631
parent 35265
77664079d0f0
child 37101
8ba9a23354ff
--- 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 );
 }

mercurial