mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
added safeguard against absurdly large packets in rsserial.cc and output of the beginning of the packet.
This commit is contained in:
parent
3ea2e0f450
commit
672ab256d7
@ -389,6 +389,11 @@ RsItem * RsSerialiser::deserialise(void *data, uint32_t *size)
|
|||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if(pkt_size > getRsPktMaxSize())
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) trying to deserialise a packet with absurdely large size " << pkt_size << ". This means there's a bug upward or packet corruption. Packet content: " << RsUtil::BinToHex((unsigned char*)data,std::min(300u,pkt_size)) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
/* store the packet size to return the amount we should use up */
|
/* store the packet size to return the amount we should use up */
|
||||||
*size = pkt_size;
|
*size = pkt_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user