Wireshark-dev: Re: [Wireshark-dev] Wireshark crashes on tvb_get_const_stringz()
From: Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Date: Tue, 20 Mar 2012 14:19:45 +0100
On Tue, Mar 20, 2012 at 03:04:23PM +0200, Kaul wrote:
> I might have used tvb_get_const_stringz() incorrectly, yet I don't think
> Wireshark should crash:
> Program received signal SIGSEGV, Segmentation fault.
> tvb_get_const_stringz (tvb=0x1c01b60, offset=10, lengthp=0x9) at
> tvbuff.c:2548
> 2548 *lengthp = size;
> 
> I'm not entirely sure why it crashes yet or why I am using it incorrectly.

Last argument of tvb_get_const_stringz() takes pointer to integer (not value!) 
and stores length of string in it.

If you want to get next N chars (not NUL terminated), and store it as C-string you
can use tvb_get_ephemeral_string() instead.