From cdcc9e249f8c5894be46d85d6a4a55d030a1766c Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Wed, 24 Jun 2015 20:38:41 +0000 Subject: [PATCH] #5964: Follow-up fix for #5456 (encrypted communication with libevent 2.1.x) I've misread libevent documentation and the check introduced was not entirely correct. Changed `evbuffer_peek` call now to only request the data which would fit into provided iovec. --- libtransmission/peer-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 5b264d049..98f806624 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -1148,7 +1148,7 @@ tr_peerIoReadBytesToBuf (tr_peerIo * io, struct evbuffer * inbuf, struct evbuffe struct evbuffer_iovec iovec; evbuffer_ptr_set (outbuf, &pos, old_length, EVBUFFER_PTR_SET); do { - if (evbuffer_peek (outbuf, byteCount, &pos, &iovec, 1) != 1) + if (evbuffer_peek (outbuf, -1, &pos, &iovec, 1) != 1) break; tr_cryptoDecrypt (&io->crypto, iovec.iov_len, iovec.iov_base, iovec.iov_base); byteCount -= iovec.iov_len; -- 2.40.0