torrentd

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

commit f6475bdb8f9698d89bfb0b474651c8f66cb2ffe6
parent 11db688588b8740c3c61479ba61f927aa7f4b234
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 18 Dec 2015 23:55:30 +0100

fix path concatenation

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

diff --git a/torrent.c b/torrent.c @@ -74,6 +74,7 @@ loadtorrent(char *f) struct ben *files, *file; struct ben *length, *path, *tmp, *a; size_t i, j, pathlen, totallen = 0; + char *p; t = ecalloc(1, sizeof(*t)); if (readfile(f, &t->buf, &t->buflen) < 0) { @@ -190,7 +191,9 @@ loadtorrent(char *f) } t->files[t->nfiles].path = ecalloc(1, pathlen); for (tmp = path; tmp; tmp = tmp->next) { - strlcat(t->files[t->nfiles].path, tmp->v->s, pathlen); + p = bstr2str(tmp->v); + strlcat(t->files[t->nfiles].path, p, pathlen); + free(p); if (tmp != path && tmp->next) strlcat(t->files[t->nfiles].path, "/", pathlen); }