fix r6965 oops

This commit is contained in:
Charles Kerr 2008-10-27 04:39:30 +00:00
parent 631d9d9a8f
commit 5ad58ea83e
1 changed files with 5 additions and 3 deletions

View File

@ -1555,12 +1555,14 @@ tr_torrentReqIsValid( const tr_torrent * tor,
if( index >= tor->info.pieceCount )
err = 1;
else if( ( offset + length ) >= tr_torPieceCountBytes( tor, index ) )
if( length < 1 )
err = 2;
else if( length > MAX_BLOCK_SIZE )
else if( ( offset + length ) > tr_torPieceCountBytes( tor, index ) )
err = 3;
else if( tr_pieceOffset( tor, index, offset, length ) > tor->info.totalSize )
else if( length > MAX_BLOCK_SIZE )
err = 4;
else if( tr_pieceOffset( tor, index, offset, length ) > tor->info.totalSize )
err = 5;
if( err ) fprintf( stderr, "index %lu offset %lu length %lu err %d\n",
(unsigned long)index, (unsigned long)offset,