shithub: riscv

Download patch

ref: 9f755671fb6f8250da9c16a9abebbf975b8bc571
parent: d0f824edc2fa69ab9fc9618a93fd6e3f15acb2b9
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);