summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorqwx <devnull@localhost>2019-01-08 13:22:09 +0100
committerqwx <devnull@localhost>2019-01-08 13:22:09 +0100
commit9f755671fb6f8250da9c16a9abebbf975b8bc571 (patch)
treed663f05f1ce4330c585d9cb0a55e6f940d0cfed9 /sys
parentd0f824edc2fa69ab9fc9618a93fd6e3f15acb2b9 (diff)
torrent: avoid trying to fetch blocks past file
Diffstat (limited to 'sys')
-rw-r--r--sys/src/cmd/ip/torrent.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/src/cmd/ip/torrent.c b/sys/src/cmd/ip/torrent.c
index 5ce321b4c..01470712f 100644
--- a/sys/src/cmd/ip/torrent.c
+++ b/sys/src/cmd/ip/torrent.c
@@ -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);