From 1cbe23667b19cff6916994d9ef60854887168151 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 1 Oct 2007 01:12:00 +0000 Subject: [PATCH] added check for valid allowed-fast messages --- src/peer_connection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 535a90142..a4d66f79c 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1597,6 +1597,15 @@ namespace libtorrent && t->have_piece(index)) return; + if (index < 0 || index >= int(m_have_piece.size())) + { +#ifdef TORRENT_VERBOSE_LOGGING + (*m_logger) << time_now_string() << " <== INVALID_ALLOWED_FAST [ " << index << " | s: " + << int(m_have_piece.size()) << " ]\n"; +#endif + return; + } + m_allowed_fast.push_back(index); // if the peer has the piece and we want