git: 9front

Download patch

ref: 5d1ba1a79297c47c9852e91c54d3ea8db5cff685
parent: f542b27e49a8f25998e65befa6ddc74b456e669c
author: qwx <devnull@localhost>
date: Tue Jan 8 08:22:09 EST 2019

torrent: avoid trying to fetch blocks past file

--- a/sys/src/cmd/ip/torrent.c
+++ b/sys/src/cmd/ip/torrent.c
@@ -811,7 +811,8 @@
 			}
 		}
 	}
-	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);
--