From: Matt Joiner Date: Sun, 21 Feb 2016 06:25:47 +0000 (+1100) Subject: Off by one error in torrent.pieceLength? X-Git-Tag: v1.0.0~869 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=61af11fddc5ec39331cdec6b1215b891167a39cb;p=btrtrc.git Off by one error in torrent.pieceLength? --- 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 {