mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
fixed two memory bugs in serialization code
This commit is contained in:
parent
31c07f4dfd
commit
91b04098b6
2 changed files with 5 additions and 6 deletions
|
@ -134,17 +134,16 @@ void RsDiscContactItem::serial_process(SerializeJob j,SerializeContext& ctx)
|
|||
|
||||
// This is a hack. Normally we should have to different item types, in order to avoid this nonesense.
|
||||
|
||||
if( (j == RsItem::DESERIALIZE && GetTlvType( &(((uint8_t *) ctx.mData)[ctx.mOffset]) )==TLV_TYPE_STR_DOMADDR) || isHidden)
|
||||
{
|
||||
isHidden = true ;
|
||||
if(j == RsItem::DESERIALIZE)
|
||||
isHidden = ( GetTlvType( &(((uint8_t *) ctx.mData)[ctx.mOffset]) )==TLV_TYPE_STR_DOMADDR);
|
||||
|
||||
if(isHidden)
|
||||
{
|
||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_DOMADDR,hiddenAddr,"hiddenAddr");
|
||||
RsTypeSerializer::serial_process<uint16_t>(j,ctx,hiddenPort,"hiddenPort");
|
||||
}
|
||||
else
|
||||
{
|
||||
isHidden = false ;
|
||||
|
||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,localAddrV4,"localAddrV4");
|
||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx, extAddrV4,"extAddrV4");
|
||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,localAddrV6,"localAddrV6");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue