fix a possible bug in getTlvString

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2166 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-31 20:17:15 +00:00
parent 15e3a0d075
commit ec7fcffcb5

View File

@ -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); char *strdata = (char *) right_shift_void_pointer(tlvstart, TLV_HEADER_SIZE);
uint16_t strsize = tlvsize - TLV_HEADER_SIZE; /* remove the header */ 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 */ *offset += tlvsize; /* step along */
return true; return true;