mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
added security check against malformed packets
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2764 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c4de9f0219
commit
695226301a
@ -333,7 +333,15 @@ int pqistore::readPkt(RsItem **item_out)
|
||||
int extralen = getRsItemSize(block) - blen;
|
||||
if (extralen > 0)
|
||||
{
|
||||
if(extralen > blen + maxlen)
|
||||
{
|
||||
std::cerr << "pqistore: ERROR: Inconsistency in packet format (extralen=" << extralen << ", maxlen=" << maxlen << "). Wasting the whole file." << std::endl ;
|
||||
free(block) ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
void *extradata = (void *) (((char *) block) + blen);
|
||||
|
||||
if (extralen != (tmplen = bio->readdata(extradata, extralen)))
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user