Mercurial > pidgin
comparison libpurple/protocols/msn/slplink.c @ 30697:f3d2a46a5ea8
Attempt to simplify and clean
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 08 Feb 2010 08:26:12 +0000 |
parents | 33b4ae796648 |
children | 24f371e16a51 |
comparison
equal
deleted
inserted
replaced
30696:d22b9e73c929 | 30697:f3d2a46a5ea8 |
---|---|
495 { | 495 { |
496 MsnSlpMessage *slpmsg; | 496 MsnSlpMessage *slpmsg; |
497 const char *data; | 497 const char *data; |
498 guint64 offset; | 498 guint64 offset; |
499 gsize len; | 499 gsize len; |
500 PurpleXfer *xfer = NULL; | |
501 | 500 |
502 if (purple_debug_is_verbose()) | 501 if (purple_debug_is_verbose()) |
503 msn_slpmsg_show(msg); | 502 msn_slpmsg_show(msg); |
504 | 503 |
505 #ifdef MSN_DEBUG_SLP_FILES | 504 #ifdef MSN_DEBUG_SLP_FILES |
506 debug_msg_to_file(msg, FALSE); | 505 debug_msg_to_file(msg, FALSE); |
507 #endif | 506 #endif |
508 | 507 |
509 if (msg->msnslp_header.total_size < msg->msnslp_header.length) | 508 if (msg->msnslp_header.total_size < msg->msnslp_header.length) |
510 { | 509 { |
511 purple_debug_error("msn", "This can't be good\n"); | 510 /* We seem to have received a bad header */ |
512 g_return_if_reached(); | 511 purple_debug_warning("msn", "Total size listed in SLP binary header " |
512 "was less than length of this particular message. This " | |
513 "should not happen. Dropping message.\n"); | |
514 return; | |
513 } | 515 } |
514 | 516 |
515 data = msn_message_get_bin_data(msg, &len); | 517 data = msn_message_get_bin_data(msg, &len); |
516 | 518 |
517 offset = msg->msnslp_header.offset; | 519 offset = msg->msnslp_header.offset; |
532 if (slpmsg->slpcall != NULL) | 534 if (slpmsg->slpcall != NULL) |
533 { | 535 { |
534 if (slpmsg->flags == 0x20 || | 536 if (slpmsg->flags == 0x20 || |
535 slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) | 537 slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) |
536 { | 538 { |
537 xfer = slpmsg->slpcall->xfer; | 539 PurpleXfer *xfer = slpmsg->slpcall->xfer; |
538 if (xfer != NULL) | 540 if (xfer != NULL) |
539 { | 541 { |
540 slpmsg->ft = TRUE; | 542 slpmsg->ft = TRUE; |
541 slpmsg->slpcall->xfer_msg = slpmsg; | 543 slpmsg->slpcall->xfer_msg = slpmsg; |
542 | 544 |
576 } | 578 } |
577 } | 579 } |
578 | 580 |
579 if (slpmsg->ft) | 581 if (slpmsg->ft) |
580 { | 582 { |
581 xfer = slpmsg->slpcall->xfer; | |
582 slpmsg->slpcall->u.incoming_data = | 583 slpmsg->slpcall->u.incoming_data = |
583 g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len); | 584 g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len); |
584 purple_xfer_prpl_ready(xfer); | 585 purple_xfer_prpl_ready(slpmsg->slpcall->xfer); |
585 } | 586 } |
586 else if (slpmsg->size && slpmsg->buffer) | 587 else if (slpmsg->size && slpmsg->buffer) |
587 { | 588 { |
588 if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size) | 589 if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size) |
589 { | 590 { |