connection.go | 2 +- diff --git a/connection.go b/connection.go index 432519f0761ecd18967f7c826caa97567191019a..8d3c45ad5d2be57603ea141536c3d15f12a46ca3 100644 --- a/connection.go +++ b/connection.go @@ -629,7 +629,7 @@ } // We know that the last byte means that at most the last 7 bits are // wasted. cn.raisePeerMinPieces(len(bf) - 7) - if cn.t.haveInfo() { + if cn.t.haveInfo() && len(bf) > cn.t.numPieces() { // Ignore known excess pieces. bf = bf[:cn.t.numPieces()] }