Wireshark-dev: [Wireshark-dev] tvb_get_nstringz0
From: Dario Lombardo <lomato@xxxxxxxxx>
Date: Fri, 26 Mar 2021 09:21:51 +0100
Hi,
I am a bit puzzled by the use of tvb_get_nstringz0. Let's say I have a packet 100 bytes long, that does NOT contain NUL. I call tvb_get_nstringz0 with a buffer 10 bytes long.
For what I can see, the function will seek the packet for NUL, stopping at the end of the packet, copying the result into the buffer. But the buffer is too short, resulting in a crash.
What's the error here? How is the caller sure their call won't be invalid? Should they always pass a long-enough buffer? Was the call to this function wrong in the first place? 
Thanks.
Dario.

--
Naima is online.