mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 19:04:25 -05:00
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:
parent
15e3a0d075
commit
ec7fcffcb5
@ -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 */
|
||||||
|
if (strsize <= 0) {
|
||||||
|
in = "";
|
||||||
|
} else {
|
||||||
in = std::string(strdata, strsize);
|
in = std::string(strdata, strsize);
|
||||||
|
}
|
||||||
|
|
||||||
*offset += tlvsize; /* step along */
|
*offset += tlvsize; /* step along */
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user