From 61af11fddc5ec39331cdec6b1215b891167a39cb Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 21 Feb 2016 17:25:47 +1100 Subject: [PATCH] Off by one error in torrent.pieceLength? --- torrent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torrent.go b/torrent.go index 3bbbcef8..00d5ac07 100644 --- a/torrent.go +++ b/torrent.go @@ -655,7 +655,7 @@ type Peer struct { } func (t *torrent) pieceLength(piece int) (len_ pp.Integer) { - if piece < 0 || piece > t.Info.NumPieces() { + if piece < 0 || piece >= t.Info.NumPieces() { return } if int(piece) == t.numPieces()-1 { -- 2.48.1