changeset 27941:db99cde1845c

Fix crashes when filenames end up being NULL in some prpls. Fixed a minor leak in MSNP9 while we're at it. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 16 Aug 2009 23:46:15 +0000
parents cd257777ac5d
children 1f2a9d38b866
files libpurple/protocols/bonjour/bonjour_ft.c libpurple/protocols/jabber/oob.c libpurple/protocols/msn/slp.c libpurple/protocols/msnp9/slp.c
diffstat 4 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour_ft.c	Sun Aug 16 23:28:12 2009 +0000
+++ b/libpurple/protocols/bonjour/bonjour_ft.c	Sun Aug 16 23:46:15 2009 +0000
@@ -450,9 +450,11 @@
 
 				/* TODO: Make sure that it is advertising a bytestreams transfer */
 
-				bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS);
+				if (filename) {
+					bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS);
 
-				parsed_receive = TRUE;
+					parsed_receive = TRUE;
+				}
 			}
 
 			if (!parsed_receive) {
--- a/libpurple/protocols/jabber/oob.c	Sun Aug 16 23:28:12 2009 +0000
+++ b/libpurple/protocols/jabber/oob.c	Sun Aug 16 23:46:15 2009 +0000
@@ -207,7 +207,10 @@
 	url = xmlnode_get_data(urlnode);
 
 	jox = g_new0(JabberOOBXfer, 1);
-	purple_url_parse(url, &jox->address, &jox->port, &jox->page, NULL, NULL);
+	if (!purple_url_parse(url, &jox->address, &jox->port, &jox->page, NULL, NULL)) {
+		g_free(url);
+		return;
+	}
 	g_free(url);
 	jox->js = js;
 	jox->headers = g_string_new("");
--- a/libpurple/protocols/msn/slp.c	Sun Aug 16 23:28:12 2009 +0000
+++ b/libpurple/protocols/msn/slp.c	Sun Aug 16 23:46:15 2009 +0000
@@ -351,7 +351,7 @@
 
 			g_free(bin);
 
-			purple_xfer_set_filename(xfer, file_name);
+			purple_xfer_set_filename(xfer, file_name ? file_name : "");
 			g_free(file_name);
 			purple_xfer_set_size(xfer, file_size);
 			purple_xfer_set_init_fnc(xfer, msn_xfer_init);
--- a/libpurple/protocols/msnp9/slp.c	Sun Aug 16 23:28:12 2009 +0000
+++ b/libpurple/protocols/msnp9/slp.c	Sun Aug 16 23:46:15 2009 +0000
@@ -338,7 +338,7 @@
 		char *bin;
 		gsize bin_len;
 		guint32 file_size;
-		char *file_name;
+		gchar *file_name;
 		gunichar2 *uni_name;
 
 		account = slpcall->slplink->session->account;
@@ -368,7 +368,8 @@
 
 			g_free(bin);
 
-			purple_xfer_set_filename(xfer, file_name);
+			purple_xfer_set_filename(xfer, file_name ? file_name : "");
+			g_free(file_name);
 			purple_xfer_set_size(xfer, file_size);
 			purple_xfer_set_init_fnc(xfer, msn_xfer_init);
 			purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel);