diff -ru libtorrent-0.12.2/src/protocol/handshake.cc libtorrent-0.12.2-noshare/src/protocol/handshake.cc --- libtorrent-0.12.2/src/protocol/handshake.cc 2008-05-07 14:19:12.000000000 +0200 +++ libtorrent-0.12.2-noshare/src/protocol/handshake.cc 2008-07-25 14:57:51.000000000 +0200 @@ -1114,7 +1114,7 @@ uint32_t length = std::min(bitfield->size_bytes() - m_writePos, m_writeBuffer.reserved()) - m_writeBuffer.size_end(); if (length > 0) { - std::memcpy(m_writeBuffer.end(), bitfield->begin() + m_writePos + m_writeBuffer.size_end(), length); + std::memset(m_writeBuffer.end(), 0, length); m_encryption.info()->encrypt(m_writeBuffer.end(), length); m_writeBuffer.move_end(length); } @@ -1128,7 +1128,9 @@ m_writeBuffer.move_end(-length); } else { - m_writePos += write_unthrottled(bitfield->begin() + m_writePos, + char dummy[bitfield->size_bytes() - m_writePos]; + std::memset(dummy, 0, bitfield->size_bytes() - m_writePos); + m_writePos += write_unthrottled(dummy, bitfield->size_bytes() - m_writePos); } } diff -ru libtorrent-0.12.2/src/protocol/peer_connection_leech.cc libtorrent-0.12.2-noshare/src/protocol/peer_connection_leech.cc --- libtorrent-0.12.2/src/protocol/peer_connection_leech.cc 2008-05-07 14:19:12.000000000 +0200 +++ libtorrent-0.12.2-noshare/src/protocol/peer_connection_leech.cc 2008-07-25 14:57:51.000000000 +0200 @@ -527,7 +527,7 @@ rak::greater(m_peerChunks.have_timer(), rak::mem_ref(&DownloadMain::have_queue_type::value_type::first))); do { - m_up->write_have((--last)->second); + --last; } while (last != haveQueue->begin() && m_up->can_write_have()); m_peerChunks.set_have_timer(last->first + 1);