From: Charles Kerr Date: Thu, 11 Nov 2010 15:31:11 +0000 (+0000) Subject: (trunk libT) add some new bugs to the code so that it will crash when vraa tries... X-Git-Tag: 2.12~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9335e02e6d55bc84a01a64feed386b3fa5081c06;p=transmission (trunk libT) add some new bugs to the code so that it will crash when vraa tries to use it --- diff --git a/libtransmission/blocklist.c b/libtransmission/blocklist.c index b96be0099..1f66dec3d 100644 --- a/libtransmission/blocklist.c +++ b/libtransmission/blocklist.c @@ -348,8 +348,8 @@ _tr_blocklistSetContent( tr_blocklist * b, ++inCount; /* zap the linefeed */ - if(( walk = strchr( line, '\r' ))) *walk = '\0'; - if(( walk = strchr( line, '\n' ))) *walk = '\0'; + if(( walk = strchr( line, '\r' ))) *walk = '\0'; + if(( walk = strchr( line, '\n' ))) *walk = '\0'; if( !parseLine( line, &range ) ) { diff --git a/libtransmission/cache.c b/libtransmission/cache.c index df0cd0d29..063b31d06 100644 --- a/libtransmission/cache.c +++ b/libtransmission/cache.c @@ -303,7 +303,7 @@ cache_block_compare( const void * va, const void * vb ) static struct cache_block * findBlock( tr_cache * cache, - tr_torrent * torrent, + tr_torrent * torrent, tr_piece_index_t piece, uint32_t offset ) { diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index 2deed8647..08b327149 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -399,7 +399,7 @@ TrOpenFile( tr_session * session, } #endif -#if defined( SYS_DARWIN ) +#if defined( SYS_DARWIN ) /** * 1. Enable readahead for reasons described above w/POSIX_FADV_SEQUENTIAL. * @@ -411,8 +411,8 @@ TrOpenFile( tr_session * session, */ { const int err = errno; - fcntl( file->fd, F_NOCACHE, 1 ); - fcntl( file->fd, F_RDAHEAD, 1 ); + fcntl( file->fd, F_NOCACHE, 1 ); + fcntl( file->fd, F_RDAHEAD, 1 ); errno = err; } #endif diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.c index 8f3f53ce1..db77d8d62 100644 --- a/libtransmission/metainfo.c +++ b/libtransmission/metainfo.c @@ -42,7 +42,7 @@ tr_metainfoGetBasename( const tr_info * inf ) for( pch=name; pch && *pch; ++pch ) if( *pch == '/' ) *pch = '_'; - + ret = tr_strdup_printf( "%s.%16.16s", name, inf->hashString ); tr_free( name ); @@ -447,7 +447,6 @@ tr_metainfoParseImpl( const tr_session * session, escape( inf->hashEscaped, inf->hash, SHA_DIGEST_LENGTH ); /* maybe get the display name */ - if( tr_bencDictFindStr( d, "display-name", &str ) ) { tr_free( inf->name ); inf->name = tr_strdup( str ); diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 1eeea1e28..56bbff42e 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -260,7 +260,7 @@ event_read_cb( int fd, short event UNUSED, void * vio ) what |= EVBUFFER_ERROR; } - tr_net_strerror( errstr, sizeof( errstr ), e ); + tr_net_strerror( errstr, sizeof( errstr ), e ); dbgmsg( io, "event_read_cb got an error. res is %d, what is %hd, errno is %d (%s)", res, what, e, errstr ); if( io->gotError != NULL ) @@ -400,7 +400,7 @@ tr_peerIoNew( tr_session * session, tr_netSetTOS( socket, session->peerSocketTOS ); maybeSetCongestionAlgorithm( socket, session->peer_congestion_algorithm ); } - + io = tr_new0( tr_peerIo, 1 ); io->magicNumber = MAGIC_NUMBER; io->refCount = 1; @@ -945,7 +945,7 @@ tr_peerIoTryRead( tr_peerIo * io, size_t howmuch ) short what = EVBUFFER_READ | EVBUFFER_ERROR; if( res == 0 ) what |= EVBUFFER_EOF; - tr_net_strerror( errstr, sizeof( errstr ), e ); + tr_net_strerror( errstr, sizeof( errstr ), e ); dbgmsg( io, "tr_peerIoTryRead got an error. res is %d, what is %hd, errno is %d (%s)", res, what, e, errstr ); io->gotError( io, what, io->userData ); } @@ -974,7 +974,7 @@ tr_peerIoTryWrite( tr_peerIo * io, size_t howmuch ) char errstr[512]; const short what = EVBUFFER_WRITE | EVBUFFER_ERROR; - tr_net_strerror( errstr, sizeof( errstr ), e ); + tr_net_strerror( errstr, sizeof( errstr ), e ); dbgmsg( io, "tr_peerIoTryWrite got an error. res is %d, what is %hd, errno is %d (%s)", n, what, e, errstr ); if( io->gotError != NULL ) diff --git a/libtransmission/ptrarray.c b/libtransmission/ptrarray.c index ed697b477..2cb892d47 100644 --- a/libtransmission/ptrarray.c +++ b/libtransmission/ptrarray.c @@ -216,4 +216,3 @@ tr_ptrArrayRemoveSorted( tr_ptrArray * t, assertSortedAndUnique( t, compare ); return ret; } - diff --git a/libtransmission/rpc-server.c b/libtransmission/rpc-server.c index 252d8357c..1e045c4a9 100644 --- a/libtransmission/rpc-server.c +++ b/libtransmission/rpc-server.c @@ -386,7 +386,7 @@ add_response( struct evhttp_request * req, EVBUFFER_LENGTH( out ) = content_len - server->stream.avail_out; #if 0 - fprintf( stderr, "compressed response is %.2f of original (raw==%zu bytes; compressed==%zu)\n", + fprintf( stderr, "compressed response is %.2f of original (raw==%zu bytes; compressed==%zu)\n", (double)EVBUFFER_LENGTH(out)/content_len, content_len, EVBUFFER_LENGTH(out) ); #endif diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index ccd253e0d..60274d698 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -786,8 +786,8 @@ copyTrackers( tr_tracker_info * tgt, const tr_tracker_info * src, int n ) { int i; int maxTier = -1; - - for( i=0; idecimal_point ))) pt[precision ? precision+1 : 0] = '\0'; return atof(buf); @@ -1608,7 +1608,7 @@ struct formatter_unit char * name; uint64_t value; }; - + struct formatter_units { struct formatter_unit units[4]; @@ -1720,7 +1720,7 @@ tr_formatter_speed_KBps( char * buf, double KBps, size_t buflen ) static struct formatter_units mem_units; unsigned int tr_mem_K = 0u; - + void tr_formatter_mem_init( unsigned int kilo, const char * kb, const char * mb, diff --git a/libtransmission/verify.c b/libtransmission/verify.c index c04973716..2cd3ec9a5 100644 --- a/libtransmission/verify.c +++ b/libtransmission/verify.c @@ -272,11 +272,11 @@ getCurrentSize( tr_torrent * tor ) return byte_count; } -static int -compareVerifyByPriorityAndSize( const void * va, const void * vb ) -{ - const struct verify_node * a = va; - const struct verify_node * b = vb; +static int +compareVerifyByPriorityAndSize( const void * va, const void * vb ) +{ + const struct verify_node * a = va; + const struct verify_node * b = vb; /* higher priority comes before lower priority */ const tr_priority_t pa = tr_torrentGetPriority( a->torrent ); @@ -288,7 +288,7 @@ compareVerifyByPriorityAndSize( const void * va, const void * vb ) if( a->current_size < b->current_size ) return -1; if( a->current_size > b->current_size ) return 1; return 0; -} +} void tr_verifyAdd( tr_torrent * tor, diff --git a/libtransmission/web.c b/libtransmission/web.c index 0102f71ad..29b46cc81 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.c @@ -144,10 +144,10 @@ createEasy( tr_session * s, struct tr_web_task * task ) const tr_address * addr; CURL * e = curl_easy_init( ); const long verbose = getenv( "TR_CURL_VERBOSE" ) != NULL; - char * cookie_filename = tr_buildPath( s->configDir, "cookies.txt", NULL ); + char * cookie_filename = tr_buildPath( s->configDir, "cookies.txt", NULL ); curl_easy_setopt( e, CURLOPT_AUTOREFERER, 1L ); - curl_easy_setopt( e, CURLOPT_COOKIEFILE, cookie_filename ); + curl_easy_setopt( e, CURLOPT_COOKIEFILE, cookie_filename ); curl_easy_setopt( e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity" ); curl_easy_setopt( e, CURLOPT_FOLLOWLOCATION, 1L ); curl_easy_setopt( e, CURLOPT_MAXREDIRS, -1L ); @@ -172,7 +172,7 @@ createEasy( tr_session * s, struct tr_web_task * task ) if( task->range ) curl_easy_setopt( e, CURLOPT_RANGE, task->range ); - tr_free( cookie_filename ); + tr_free( cookie_filename ); return e; } @@ -232,7 +232,7 @@ tr_webRun( tr_session * session, * http://msdn.microsoft.com/en-us/library/ms740141%28VS.85%29.aspx * On win32, any two of the parameters, readfds, writefds, or exceptfds, * can be given as null. At least one must be non-null, and any non-null - * descriptor set must contain at least one handle to a socket. + * descriptor set must contain at least one handle to a socket. */ static void tr_select( int nfds, @@ -252,7 +252,7 @@ tr_select( int nfds, char errstr[512]; const int e = EVUTIL_SOCKET_ERROR( ); tr_net_strerror( errstr, sizeof( errstr ), e ); - dbgmsg( "Error: select (%d) %s", e, errstr ); + dbgmsg( "Error: select (%d) %s", e, errstr ); } #else select( nfds, r_fd_set, w_fd_set, c_fd_set, t );