diff --git a/libretroshare/src/serialiser/rstlvbase.cc b/libretroshare/src/serialiser/rstlvbase.cc index 2f64ffff3..d407edd62 100644 --- a/libretroshare/src/serialiser/rstlvbase.cc +++ b/libretroshare/src/serialiser/rstlvbase.cc @@ -449,7 +449,11 @@ bool GetTlvString(void *data, uint32_t size, uint32_t *offset, char *strdata = (char *) right_shift_void_pointer(tlvstart, TLV_HEADER_SIZE); uint16_t strsize = tlvsize - TLV_HEADER_SIZE; /* remove the header */ - in = std::string(strdata, strsize); + if (strsize <= 0) { + in = ""; + } else { + in = std::string(strdata, strsize); + } *offset += tlvsize; /* step along */ return true;