Mercurial > pidgin
changeset 10092:1843023b8189
[gaim-migrate @ 11109]
This fixes the crash after signon on MSN when you have Miranda users on your
buddy list.
I also tidied up the printing of SLP debug info when it's enabled, but it's not
enabled unless you explicitly enable it, so you probably won't notice.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Wed, 13 Oct 2004 14:40:45 +0000 |
parents | 4e376556566e |
children | 9d839c9f6c2d |
files | src/protocols/msn/msg.c src/protocols/msn/slp.h src/protocols/msn/slplink.c src/protocols/msn/slplink.h |
diffstat | 4 files changed, 33 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/msn/msg.c Wed Oct 13 12:26:10 2004 +0000 +++ b/src/protocols/msn/msg.c Wed Oct 13 14:40:45 2004 +0000 @@ -658,20 +658,17 @@ if (msg->msnslp_message) { - g_string_append_printf(str, "%u ", msg->msnslp_header.session_id); - g_string_append_printf(str, "%u ", msg->msnslp_header.id); - g_string_append_printf(str, "%llu ", msg->msnslp_header.offset); - g_string_append(str, "\r\n"); - g_string_append_printf(str, "%llu ", - msg->msnslp_header.total_size); - g_string_append_printf(str, "%u ", msg->msnslp_header.length); - g_string_append_printf(str, "%u ", msg->msnslp_header.flags); - g_string_append(str, "\r\n"); - g_string_append_printf(str, "%u ", msg->msnslp_header.ack_id); - g_string_append_printf(str, "%u ", msg->msnslp_header.ack_sub_id); - g_string_append_printf(str, "%lld ", msg->msnslp_header.ack_size); - g_string_append(str, "\r\n"); + g_string_append_printf(str, "Session ID: %u\r\n", msg->msnslp_header.session_id); + g_string_append_printf(str, "ID: %u\r\n", msg->msnslp_header.id); + g_string_append_printf(str, "Offset: %llu\r\n", msg->msnslp_header.offset); + g_string_append_printf(str, "Total size: %llu\r\n", msg->msnslp_header.total_size); + g_string_append_printf(str, "Length: %u\r\n", msg->msnslp_header.length); + g_string_append_printf(str, "Flags: 0x%x\r\n", msg->msnslp_header.flags); + g_string_append_printf(str, "ACK ID: %u\r\n", msg->msnslp_header.ack_id); + g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); + g_string_append_printf(str, "ACK Size: %lld\r\n", msg->msnslp_header.ack_size); +#ifdef DEBUG_SLP_VERBOSE if (body != NULL) { if (text_body) @@ -696,9 +693,9 @@ g_string_append(str, "\r\n"); } } +#endif - g_string_append_printf(str, "%u ", msg->msnslp_footer.value); - g_string_append(str, "\r\n"); + g_string_append_printf(str, "Footer: %u\r\n", msg->msnslp_footer.value); } else {
--- a/src/protocols/msn/slp.h Wed Oct 13 12:26:10 2004 +0000 +++ b/src/protocols/msn/slp.h Wed Oct 13 14:40:45 2004 +0000 @@ -25,6 +25,7 @@ #define _MSN_SLP_H_ /* #define DEBUG_SLP 1 */ +/* #define DEBUG_SLP_VERBOSE 1 */ /* #define DEBUG_SLP_FILES 1 */ #include "slpcall.h"
--- a/src/protocols/msn/slplink.c Wed Oct 13 12:26:10 2004 +0000 +++ b/src/protocols/msn/slplink.c Wed Oct 13 14:40:45 2004 +0000 @@ -447,7 +447,6 @@ slpmsg->session_id = msg->msnslp_header.session_id; slpmsg->size = msg->msnslp_header.total_size; slpmsg->flags = msg->msnslp_header.flags; - slpmsg->buffer = g_malloc(slpmsg->size); if (slpmsg->session_id) { @@ -471,10 +470,19 @@ } } } + if (!slpmsg->fp) + { + slpmsg->buffer = g_try_malloc(slpmsg->size); + if (slpmsg->buffer == NULL) + { + gaim_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); + return; + } + } } else { - slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.id); + slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.session_id, msg->msnslp_header.id); } if (slpmsg != NULL) @@ -486,7 +494,13 @@ } else { - memcpy(slpmsg->buffer + offset, data, len); + if ((offset + len) > slpmsg->size) + { + gaim_debug_error("msn", "Oversized slpmsg\n"); + g_return_if_reached(); + } + else + memcpy(slpmsg->buffer + offset, data, len); } } else @@ -544,7 +558,7 @@ } MsnSlpMessage * -msn_slplink_message_find(MsnSlpLink *slplink, long id) +msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) { GList *e; @@ -552,7 +566,7 @@ { MsnSlpMessage *slpmsg = e->data; - if (slpmsg->id == id) + if ((slpmsg->session_id == session_id) && (slpmsg->id == id)) return slpmsg; }
--- a/src/protocols/msn/slplink.h Wed Oct 13 12:26:10 2004 +0000 +++ b/src/protocols/msn/slplink.h Wed Oct 13 14:40:45 2004 +0000 @@ -70,7 +70,7 @@ void msn_slplink_unleash(MsnSlpLink *slplink); void msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg); void msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg); -MsnSlpMessage *msn_slplink_message_find(MsnSlpLink *slplink, long id); +MsnSlpMessage *msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id); void msn_slplink_append_slp_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); void msn_slplink_remove_slp_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg);