mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-04 09:05:34 -05:00
fixed potential crash in pqisslstore
This commit is contained in:
parent
70bf938654
commit
9b64b96811
@ -391,25 +391,26 @@ bool pqiSSLstore::encryptedSendItems(const std::list<RsItem*>& rsItemList)
|
|||||||
std::list<RsItem*>::const_iterator it;
|
std::list<RsItem*>::const_iterator it;
|
||||||
uint32_t sizeItems = 0, sizeItem = 0;
|
uint32_t sizeItems = 0, sizeItem = 0;
|
||||||
uint32_t offset = 0;
|
uint32_t offset = 0;
|
||||||
char* data = NULL;
|
|
||||||
|
|
||||||
for(it = rsItemList.begin(); it != rsItemList.end(); ++it)
|
for(it = rsItemList.begin(); it != rsItemList.end(); ++it)
|
||||||
sizeItems += rsSerialiser->size(*it);
|
if(*it != NULL)
|
||||||
|
sizeItems += rsSerialiser->size(*it);
|
||||||
|
|
||||||
data = new char[sizeItems];
|
RsTemporaryMemory data(sizeItems) ;
|
||||||
|
|
||||||
for(it = rsItemList.begin(); it != rsItemList.end(); ++it)
|
for(it = rsItemList.begin(); it != rsItemList.end(); ++it)
|
||||||
{
|
if(*it != NULL)
|
||||||
sizeItem = rsSerialiser->size(*it);
|
{
|
||||||
|
sizeItem = rsSerialiser->size(*it);
|
||||||
|
|
||||||
if(rsSerialiser->serialise(*it, (data+offset),&sizeItem))
|
if(rsSerialiser->serialise(*it, &data[offset],&sizeItem))
|
||||||
offset += sizeItem;
|
offset += sizeItem;
|
||||||
else
|
else
|
||||||
std::cerr << "(EE) pqiSSLstore::encryptedSendItems(): One item did not serialize. The item is probably unknown from the serializer. Dropping the item. " << std::endl;
|
std::cerr << "(EE) pqiSSLstore::encryptedSendItems(): One item did not serialize. The item is probably unknown from the serializer. Dropping the item. " << std::endl;
|
||||||
|
|
||||||
if (!(bio_flags & BIN_FLAGS_NO_DELETE))
|
if (!(bio_flags & BIN_FLAGS_NO_DELETE))
|
||||||
delete *it;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
@ -418,9 +419,6 @@ bool pqiSSLstore::encryptedSendItems(const std::list<RsItem*>& rsItemList)
|
|||||||
else
|
else
|
||||||
result = false;
|
result = false;
|
||||||
|
|
||||||
if(data != NULL)
|
|
||||||
delete[] data;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user