Sat, 23 Nov 2013 17:52:02 -0500
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
| libpurple/protocols/jabber/oob.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/protocols/jabber/oob.c Thu Nov 21 10:08:55 2013 +0100 +++ b/libpurple/protocols/jabber/oob.c Sat Nov 23 17:52:02 2013 -0500 @@ -137,8 +137,8 @@ *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");