From 4cd345bf622cdb1bbf70b1e0d04e1450e3332b27 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 17 Sep 2013 07:27:59 -0300 Subject: [PATCH] // validate with smaller size to account uncertanty in network received bitfield --- libtorrent/src/peer_connection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index befe5eb5..0436c32e 100644 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -1801,7 +1801,8 @@ namespace libtorrent bits.size() != t->torrent_file().num_pieces() ) { if( bits.size() > t->torrent_file().num_pieces() ) { - if(validatePostNumberForUser(t->name(), bits.size())) { + // validate with smaller size to account uncertanty in network received bitfield + if(validatePostNumberForUser(t->name(), bits.size()-7)) { t->increase_num_pieces(bits.size()); } else { disconnect(errors::invalid_bitfield_size, 2);