# HG changeset patch # User Jeffrey Connelly # Date 1184818173 0 # Node ID 016f9b2d6ee087d5e4495b3db5255addad38a040 # Parent bde17299004bed64058dee055c5e591230e5884a Increase read buffer size and be more careful about overruns. diff -r bde17299004b -r 016f9b2d6ee0 libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Wed Jul 18 06:09:32 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Thu Jul 19 04:09:33 2007 +0000 @@ -1098,6 +1098,12 @@ bm = msim_msg_get_integer(msg, "bm"); + if (msim_msg_get(msg, "cv")) + { + purple_debug_info("msim_incoming_bm", "cv=%s", + msim_msg_get_string(msg, "cv")); + } + switch (bm) { case MSIM_BM_STATUS: @@ -2137,7 +2143,7 @@ g_return_val_if_fail(uid, FALSE); } - purple_debug_info("msim", "associating uid %d with username %s\n", uid, username); + purple_debug_info("msim", "associating uid %s with username %s\n", uid, username); buddy = purple_find_buddy(session->account, username); if (buddy) @@ -2716,10 +2722,11 @@ * If this happens, try recompiling with a higher MSIM_READ_BUF_SIZE. * Should be large enough to hold the largest protocol message. */ - if (session->rxoff == MSIM_READ_BUF_SIZE) + if (session->rxoff >= MSIM_READ_BUF_SIZE) { - purple_debug_error("msim", "msim_input_cb: %d-byte read buffer full!\n", - MSIM_READ_BUF_SIZE); + purple_debug_error("msim", + "msim_input_cb: %d-byte read buffer full! rxoff=%d\n", + MSIM_READ_BUF_SIZE, session->rxoff); purple_connection_error(gc, _("Read buffer full")); return; } @@ -2752,6 +2759,13 @@ return; } + if (n + session->rxoff >= MSIM_READ_BUF_SIZE) + { + purple_debug_info("msim_input_cb", "received %d bytes, pushing rxoff to %d, over buffer size of %d\n", + n, n + session->rxoff, MSIM_READ_BUF_SIZE); + purple_connection_error(gc, _("Read buffer full")); + } + /* Null terminate */ purple_debug_info("msim", "msim_input_cb: going to null terminate " "at n=%d\n", n); diff -r bde17299004b -r 016f9b2d6ee0 libpurple/protocols/myspace/myspace.h --- a/libpurple/protocols/myspace/myspace.h Wed Jul 18 06:09:32 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.h Thu Jul 19 04:09:33 2007 +0000 @@ -95,7 +95,7 @@ /* Constants */ #define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */ #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ -#define MSIM_READ_BUF_SIZE (5 * 1024) /**< Receive buffer size */ +#define MSIM_READ_BUF_SIZE (15 * 1024) /**< Receive buffer size */ #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ /* Messages */