torrentd

simple torrent daemon
git clone git://git.2f30.org/torrentd
Log | Files | Refs | LICENSE

commit ad8658ee5a1d071766a41db76e86ea0daf384084
parent cb90595462d6ae257f799a7b9142265f4c61822d
Author: sin <sin@2f30.org>
Date:   Fri, 18 Dec 2015 16:05:40 +0000

Add check for nil piecelen

Diffstat:
Mtorrent.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/torrent.c b/torrent.c @@ -106,6 +106,10 @@ loadtorrent(char *f) goto err2; } t->piecelen = dlookstr(t->info, "piece length")->i; + if (!t->piecelen) { + warnx("piecelen is 0 in %s", f); + goto err2; + } t->npieces = (t->length + t->piecelen - 1) / t->piecelen; t->piecebm = newbit(t->npieces);