]> git.lizzy.rs Git - plan9front.git/commitdiff
torrent: avoid trying to fetch blocks past file
authorqwx <devnull@localhost>
Tue, 8 Jan 2019 12:22:09 +0000 (13:22 +0100)
committerqwx <devnull@localhost>
Tue, 8 Jan 2019 12:22:09 +0000 (13:22 +0100)
sys/src/cmd/ip/torrent.c

index 5ce321b4cae1900bed4ba74a2638757b65c8c5cf..01470712f73168784fcb3de1d21ff4d6d6ca4f0c 100644 (file)
@@ -811,7 +811,8 @@ Error:
                        }
                }
        }
-       havepiece(off / blocksize, w->str);
+       if(off < f->off + f->len)
+               havepiece(off / blocksize, w->str);
        havepiece(f->off / blocksize, w->str);
        close(fd);
        exits(0);