/pidgin/main: 33e652e01e49: jabber: parse oob file transfer cont...

Daniel Atallah datallah at pidgin.im
Sat Nov 23 17:55:42 EST 2013


Changeset: 33e652e01e496454bfb35a0e25e9af511ecb031f
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2013-11-23 17:52 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/33e652e01e49

Description:

jabber: parse oob file transfer content-length into a unsigned integer of the
        same size as the xfer size

 * There is no significant effect of this change apart from likely making sscanf
   fail more cleanly for out of range variables instead of wrapping when an
   invalid value is specified.

 * Thanks to Matt Jones for pointing out that this could be improved

diffstat:

 libpurple/protocols/jabber/oob.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (14 lines):

diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c
--- a/libpurple/protocols/jabber/oob.c
+++ b/libpurple/protocols/jabber/oob.c
@@ -137,8 +137,8 @@ static gssize jabber_oob_xfer_read(gucha
 			*tmp = '\0';
 			lenstr = strstr(jox->headers->str, "Content-Length: ");
 			if(lenstr) {
-				int size;
-				if (sscanf(lenstr, "Content-Length: %d", &size) == 1)
+				gsize size;
+				if (sscanf(lenstr, "Content-Length: %" G_GSIZE_FORMAT, &size) == 1)
 					purple_xfer_set_size(xfer, size);
 				else {
 					purple_debug_error("jabber", "Unable to parse Content-Length!\n");



More information about the Commits mailing list