diff libpurple/protocols/qq/im.c @ 16208:85d5942e80e9

Port SVN revisions 18230 to 18232 from Mark Huetsch from sf SVN to Pidgin Monotone. Original commit messages: Bug 1671638 fixed bhpan. Bug 1658961 fixed by gnap. Fixed a bug where gaim was playing n x n times user leaving chat room sound when opening a QQ protocol chat room, n equaling the number of users in the chat room. Patch by gnap.
author Mark Doliner <mark@kingant.net>
date Mon, 16 Apr 2007 06:37:20 +0000
parents 32c366eeeb99
children b8572b937c09
line wrap: on
line diff
--- 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;
 	}