read string: fix out of bound bug
When the bytestring we were about to copy was at the end of the TVB, we were outrunning the original buffer by trying to read "size + 1". Stopping the read at size, then expending the newly created bytestring instead.
This commit is contained in:
parent
2f0b6c24d8
commit
05585f85fc
|
@ -169,7 +169,8 @@ function read_string(tvb, pinfo, tree, offset)
|
||||||
-- Note: the offset indexes the original tvb, not the
|
-- Note: the offset indexes the original tvb, not the
|
||||||
-- temporarily created one. There's no need to take this new
|
-- temporarily created one. There's no need to take this new
|
||||||
-- null bit into account.
|
-- null bit into account.
|
||||||
local tvb_clone = tvb:bytes(offset, size + 1)
|
local tvb_clone = tvb:bytes(offset, size)
|
||||||
|
tvb_clone:set_size(size + 1)
|
||||||
tvb_clone:set_index(size, 0)
|
tvb_clone:set_index(size, 0)
|
||||||
str = tvb_clone(0,size+1):tvb():range(0,size+1):string()
|
str = tvb_clone(0,size+1):tvb():range(0,size+1):string()
|
||||||
offset = offset + size
|
offset = offset + size
|
||||||
|
|
Loading…
Reference in a new issue