(trunk libT) #4173 "crashing with r12315 in Debian" -- apply patch from comment:8 for testing in 2.30b2

This commit is contained in:
Jordan Lee 2011-04-09 14:36:33 +00:00
parent b4cdc74706
commit bad3cb53a3
1 changed files with 5 additions and 1 deletions

View File

@ -1051,13 +1051,17 @@ evbuffer_add_uint64( struct evbuffer * outbuf, uint64_t addme_hll )
void
tr_peerIoReadBytesToBuf( tr_peerIo * io, struct evbuffer * inbuf, struct evbuffer * outbuf, size_t byteCount )
{
struct evbuffer * tmp;
const size_t old_length = evbuffer_get_length( outbuf );
assert( tr_isPeerIo( io ) );
assert( evbuffer_get_length( inbuf ) >= byteCount );
/* append it to outbuf */
evbuffer_remove_buffer( inbuf, outbuf, byteCount );
tmp = evbuffer_new( );
evbuffer_remove_buffer( inbuf, tmp, byteCount );
evbuffer_add_buffer( outbuf, tmp );
evbuffer_free( tmp );
/* decrypt if needed */
if( io->encryption_type == PEER_ENCRYPTION_RC4 ) {