Mercurial > pidgin
changeset 30846:e0c374ad8fd3
Set the correct length of the data before calling the function to process it.
author | masca@cpw.pidgin.im |
---|---|
date | Tue, 06 Jul 2010 18:56:58 +0000 |
parents | 6e7a0e87d589 |
children | 74c4aa38adfc |
files | libpurple/protocols/msn/msg.c libpurple/protocols/msn/slplink.c |
diffstat | 2 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c Tue Jul 06 18:51:44 2010 +0000 +++ b/libpurple/protocols/msn/msg.c Tue Jul 06 18:56:58 2010 +0000 @@ -942,8 +942,12 @@ data = msn_message_get_bin_data(msg, &len); - if (msg->part) - msn_slplink_process_msg(slplink, msg->part->header, data, len); + if (msg->part) { + len -= P2P_PACKET_HEADER_SIZE; + len -= P2P_PACKET_FOOTER_SIZE; + + msn_slplink_process_msg(slplink, msg->part->header, data+P2P_PACKET_HEADER_SIZE, len); + } else /* This should never happen. */ purple_debug_fatal("msn", "P2P message without a Part.\n"); }
--- a/libpurple/protocols/msn/slplink.c Tue Jul 06 18:51:44 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Tue Jul 06 18:56:58 2010 +0000 @@ -463,9 +463,6 @@ MsnSlpMessage *slpmsg; guint64 offset; - len -= P2P_PACKET_HEADER_SIZE; - len -= P2P_PACKET_FOOTER_SIZE; - if (header->total_size < header->length) { /* We seem to have received a bad header */