g_memdup() the icon data before setting it as the buddy icon. soc.2007.msimprpl

Thu, 23 Aug 2007 06:02:54 +0000

author
Jeff Connelly <jeff2@soc.pidgin.im>
date
Thu, 23 Aug 2007 06:02:54 +0000
branch
soc.2007.msimprpl
changeset 19528
158870ab9228
parent 19527
039fcd700802
child 19529
e64a036833ed

g_memdup() the icon data before setting it as the buddy icon.
Closes #2725.

libpurple/protocols/myspace/myspace.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/myspace/myspace.c	Thu Aug 23 04:43:04 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Thu Aug 23 06:02:54 2007 +0000
@@ -1784,7 +1784,7 @@
 	return rc;
 }
 
-/* Process an incoming media (buddy icon) message. */
+/* Process an incoming media (message background?) message. */
 static gboolean
 msim_incoming_media(MsimSession *session, MsimMessage *msg)
 {
@@ -2656,11 +2656,18 @@
 	purple_debug_info("msim_downloaded_buddy_icon",
 			"Downloaded %d bytes\n", len);
 
+	if (!url_text) {
+		purple_debug_info("msim_downloaded_buddy_icon",
+				"failed to download icon for %s",
+				user->buddy->name);
+		return;
+	}
+
 	purple_buddy_icons_set_for_user(user->buddy->account,
 			user->buddy->name,
-			(gchar *)url_text, len, 
-			/*  Use URL itself as buddy icon "checksum" */
-			user->image_url);
+			g_memdup((gchar *)url_text, len), len, 
+			/* Use URL itself as buddy icon "checksum" (TODO: ETag) */
+			user->image_url);		/* checksum */
 }
 
 /** Store a field of information about a buddy. */

mercurial