mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
corrected handling of null strings in RsTlvBase::GetTlvString()
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2766 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0d533d14b1
commit
d027af3324
@ -138,7 +138,7 @@ bool SkipUnknownTlv(void *data, uint32_t size, uint32_t *offset)
|
||||
|
||||
/* extract the type and size */
|
||||
void *tlvstart = right_shift_void_pointer(data, *offset);
|
||||
uint16_t tlvtype = GetTlvType(tlvstart);
|
||||
//uint16_t tlvtype = GetTlvType(tlvstart);
|
||||
uint32_t tlvsize = GetTlvSize(tlvstart);
|
||||
|
||||
/* check that there is size */
|
||||
@ -409,7 +409,15 @@ bool GetTlvString(void *data, uint32_t size, uint32_t *offset,
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
if (size < *offset + TLV_HEADER_SIZE)
|
||||
// Check if we have a null string (this happens with certs)
|
||||
//
|
||||
if (size == *offset)
|
||||
{
|
||||
in = "" ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
if (size < *offset)
|
||||
{
|
||||
#ifdef TLV_BASE_DEBUG
|
||||
std::cerr << "GetTlvString() FAILED - not enough space" << std::endl;
|
||||
|
@ -427,6 +427,10 @@ bool RsTlvKeySignature::GetTlv(void *data, uint32_t size, uint32_t *offset) /*
|
||||
|
||||
ok &= GetTlvString(data, tlvend, offset, TLV_TYPE_STR_KEYID, keyId);
|
||||
ok &= signData.GetTlv(data, tlvend, offset);
|
||||
|
||||
// The ssl cert is possibly void, i.e. an empty string. This is handled by
|
||||
// GetTlvString().
|
||||
//
|
||||
ok &= GetTlvString(data, tlvend, offset, TLV_TYPE_STR_CERT_SSL, sslCert);
|
||||
|
||||
/***************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user