pidgin, im.pidgin.pidgin.next.minor: 570b107a: jabber: Slightly better handling of larg...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Apr 2 15:55:47 EDT 2011


----------------------------------------------------------------------
Revision: 570b107a62822dd538074753d93b576dea0043a3
Parent:   ece03c16966f58e1db43e5c20fe35a6707b468d2
Author:   darkrain42 at pidgin.im
Date:     04/02/11 14:03:54
Branch:   im.pidgin.pidgin
Branch:   im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/570b107a62822dd538074753d93b576dea0043a3

Changelog: 

jabber: Slightly better handling of large files (on receipt).

Refs #1185, because the commenter there noted the issue with XMPP.

Changes against parent ece03c16966f58e1db43e5c20fe35a6707b468d2

  patched  libpurple/protocols/jabber/si.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	fd880f6a5e099c93e420bfcca42b36da7e2eec1d
+++ libpurple/protocols/jabber/si.c	6cc1ef0846fe2765d00daddbeceb5d6608ec16ca
@@ -1683,6 +1683,7 @@ void jabber_si_parse(JabberStream *js, c
 	PurpleXfer *xfer;
 	xmlnode *file, *feature, *x, *field, *option, *value, *thumbnail;
 	const char *stream_id, *filename, *filesize_c, *profile;
+	guint64 filesize_64 = 0;
 	size_t filesize = 0;
 
 	if(!(profile = xmlnode_get_attrib(si, "profile")) ||
@@ -1699,7 +1700,17 @@ void jabber_si_parse(JabberStream *js, c
 		return;
 
 	if((filesize_c = xmlnode_get_attrib(file, "size")))
-		filesize = strtoul(filesize_c, NULL, 10);
+		filesize_64 = g_ascii_strtoull(filesize_c, NULL, 10);
+	/* TODO 3.0.0: When the core uses a guint64, this is redundant.
+	 * See #8477.
+	 */
+	if (filesize_64 > G_MAXSIZE) {
+		/* Shoudl this pop up a warning? */
+		purple_debug_warning("jabber", "Unable to transfer file (too large)"
+		                     " -- see #8477 for more details.");
+		return;
+	}
+	filesize = filesize_64;
 
 	if(!(feature = xmlnode_get_child(si, "feature")))
 		return;


More information about the Commits mailing list