libpurple/protocols/qq/im.c

changeset 30857
1a7e2da2ab01
parent 30706
612b36b49058
child 31393
04447b1f6403
--- a/libpurple/protocols/qq/im.c	Sun Oct 17 03:40:26 2010 +0000
+++ b/libpurple/protocols/qq/im.c	Sun Oct 17 03:55:04 2010 +0000
@@ -547,7 +547,6 @@
 	const gchar *start, *end, *last;
 	GData *attribs;
 	gchar *tmp;
-	unsigned char *rgb;
 
 	g_return_val_if_fail(msg != NULL, NULL);
 
@@ -570,8 +569,11 @@
 
 		tmp = g_datalist_get_data(&attribs, "color");
 		if (tmp && strlen(tmp) > 1) {
-			rgb = purple_base16_decode(tmp + 1, NULL);
-			g_memmove(fmt->rgb, rgb, 3);
+			unsigned char *rgb;
+			gsize rgb_len;
+			rgb = purple_base16_decode(tmp + 1, &rgb_len);
+			if (rgb != NULL && rgb_len >= 3)
+				g_memmove(fmt->rgb, rgb, 3);
 			g_free(rgb);
 		}
 

mercurial