]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Off by one error in torrent.pieceLength?
authorMatt Joiner <anacrolix@gmail.com>
Sun, 21 Feb 2016 06:25:47 +0000 (17:25 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 21 Feb 2016 06:25:47 +0000 (17:25 +1100)
torrent.go

index 3bbbcef8623bb73417fdc83b0dde7ad650403a8f..00d5ac07aeb3d98e378a92a07b86d486a2447db4 100644 (file)
@@ -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 {