Blame SOURCES/pidgin-2.10.7-CVE-2013-6489.patch

abdd45
diff -up pidgin-2.10.7/libpurple/protocols/mxit/markup.c.CVE-2013-6489 pidgin-2.10.7/libpurple/protocols/mxit/markup.c
abdd45
--- pidgin-2.10.7/libpurple/protocols/mxit/markup.c.CVE-2013-6489	2013-02-11 04:16:52.000000000 -0500
abdd45
+++ pidgin-2.10.7/libpurple/protocols/mxit/markup.c	2014-01-29 20:55:34.239345911 -0500
abdd45
@@ -204,7 +204,8 @@ static unsigned int asn_getlength( const
abdd45
  */
abdd45
 static int asn_getUtf8( const char* data, char type, char** utf8 )
abdd45
 {
abdd45
-	int		len;
abdd45
+	unsigned int len;
abdd45
+	gchar *out_str;
abdd45
 
abdd45
 	/* validate the field type [1 byte] */
abdd45
 	if ( data[0] != type ) {
abdd45
@@ -213,10 +214,17 @@ static int asn_getUtf8( const char* data
abdd45
 		return -1;
abdd45
 	}
abdd45
 
abdd45
-	len = data[1];						/* length field [1 bytes] */
abdd45
-	*utf8 = g_malloc( len + 1 );
abdd45
-	memcpy( *utf8, &data[2], len );		/* data field */
abdd45
-	(*utf8)[len] = '\0';
abdd45
+	len = (uint8_t)data[1]; /* length field [1 byte] */
abdd45
+	out_str = g_malloc(len + 1);
abdd45
+	if (out_str == NULL) {
abdd45
+		purple_debug_fatal(MXIT_PLUGIN_ID, "asn_getUtf8: out of memory");
abdd45
+		return -1;
abdd45
+	}
abdd45
+
abdd45
+	memcpy(out_str, &data[2], len); /* data field */
abdd45
+	out_str[len] = '\0';
abdd45
+
abdd45
+	*utf8 = out_str;
abdd45
 
abdd45
 	return ( len + 2 );
abdd45
 }