# HG changeset patch # User Paul Aurich # Date 1301767434 0 # Node ID 0123005d0fb8879731d0dfa783abd60e655e8dd7 # Parent a9e077fb65e9a4aff1905103281a6b75b8b10802 jabber: Slightly better handling of large files (on receipt). Refs #1185, because the commenter there noted the issue with XMPP. diff -r a9e077fb65e9 -r 0123005d0fb8 libpurple/protocols/jabber/si.c --- a/libpurple/protocols/jabber/si.c Thu Mar 31 04:41:27 2011 +0000 +++ b/libpurple/protocols/jabber/si.c Sat Apr 02 18:03:54 2011 +0000 @@ -1683,6 +1683,7 @@ 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 @@ 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;