diff --git a/libretroshare/src/serialiser/rstlvbase.cc b/libretroshare/src/serialiser/rstlvbase.cc index d407edd62..01a5f571a 100644 --- a/libretroshare/src/serialiser/rstlvbase.cc +++ b/libretroshare/src/serialiser/rstlvbase.cc @@ -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; diff --git a/libretroshare/src/serialiser/rstlvkeys.cc b/libretroshare/src/serialiser/rstlvkeys.cc index 542285285..622911fe1 100644 --- a/libretroshare/src/serialiser/rstlvkeys.cc +++ b/libretroshare/src/serialiser/rstlvkeys.cc @@ -427,7 +427,11 @@ 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); - ok &= GetTlvString(data, tlvend, offset, TLV_TYPE_STR_CERT_SSL, sslCert); + + // 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); /*************************************************************************** * NB: extra components could be added (for future expansion of the type).