libeech

BitTorrent library
git clone git://z3bra.org/libeech.git
Log | Files | Refs | README | LICENSE

commit 774c0676d1298d2731342468f3f53c0f4e5a9630
parent f7370a56387cdf870b62b309db021c9c4f2ae9bd
Author: z3bra <contactatz3bradotorg>
Date:   Thu Jul  5 08:14:06 +0200

Fix off-by-one error with when passing payload to pwprxcb()

Diffstat:
libeech.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libeech.c b/libeech.c @@ -611,9 +611,9 @@ pwprxpc(struct torrent *t, struct peer *p, size_t sz, char *pl) char *blk; struct peer *b; - idx = ntohl(U32(pl+1)); - off = ntohl(U32(pl+5)); - blk = pl + 9; + idx = ntohl(U32(pl)); + off = ntohl(U32(pl+4)); + blk = pl + 8; memcpy(p->piece.blks + off, blk, sz - 8); @@ -688,7 +688,7 @@ pwprx(struct torrent *t, struct peer *p) p->rxbufsz = 0; p->state |= HANDSHAKERCVD; } else if (!pwprecv(p)) { - pwprxcb(t, p, p->rxbuf[4], p->rxbufsz - 5, p->rxbuf+4); + pwprxcb(t, p, p->rxbuf[4], p->rxbufsz - 5, p->rxbuf+5); memset(p->rxbuf, 0, MSGSIZ); p->rxbufsz = 0; }