libpurple/protocols/qq/im.c

changeset 16271
9605b8b1c673
parent 15884
4de1981757fc
child 18068
b6554e3c8224
child 18273
e61c53184c52
--- a/libpurple/protocols/qq/im.c	Mon Apr 16 05:37:44 2007 +0000
+++ b/libpurple/protocols/qq/im.c	Mon Apr 16 06:37:20 2007 +0000
@@ -123,7 +123,7 @@
 			    const gchar *font_name,
 			    gboolean is_bold, gboolean is_italic, gboolean is_underline, gint tail_len)
 {
-	gchar *s1, *s2;
+	gchar *s1;
 	unsigned char *rgb;
 	gint font_name_len;
 	guint8 *send_im_tail;
@@ -159,13 +159,20 @@
 		s1 = g_strndup(font_color + 1, 6);
 		/* Henry: maybe this is a bug of purple, the string should have
 		 * the length of odd number @_@
+		 * George Ang: This BUG maybe fixed by Purple. adding new byte
+		 * would cause a crash.
 		 */
-		s2 = g_strdup_printf("%sH", s1);
-		rgb = purple_base16_decode(s2, NULL);
+		/* s2 = g_strdup_printf("%sH", s1); */
+		rgb = purple_base16_decode(s1, NULL);
 		g_free(s1);
-		g_free(s2);
-		memcpy(send_im_tail + 2, rgb, 3);
-		g_free(rgb);
+		/* g_free(s2); */
+		if (rgb)
+		{
+			memcpy(send_im_tail + 2, rgb, 3);
+			g_free(rgb);
+		} else {
+			send_im_tail[2] = send_im_tail[3] = send_im_tail[4] = 0;
+		}
 	} else {
 		send_im_tail[2] = send_im_tail[3] = send_im_tail[4] = 0;
 	}

mercurial