mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
added additional checking of incoming compressed chunk map, in case the data is currupted, which might happens with a corrupted ft_transfer.cfg file.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5816 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f1d3cf102f
commit
d3a3efd492
@ -94,6 +94,17 @@ ChunkMap::ChunkMap(uint64_t s,bool availability)
|
||||
|
||||
void ChunkMap::setAvailabilityMap(const CompressedChunkMap& map)
|
||||
{
|
||||
// do some sanity check
|
||||
//
|
||||
|
||||
if( (((int)_map.size()-1)>>5) >= map._map.size() )
|
||||
{
|
||||
std::cerr << "ChunkMap::setPeerAvailabilityMap: Compressed chunkmap received is too small or corrupted." << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
// copy the map
|
||||
//
|
||||
_file_is_complete = true ;
|
||||
_total_downloaded = 0 ;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user