Wireshark-dev: Re: [Wireshark-dev] Wireshark crashes on tvb_get_const_stringz()
From: Kaul <mykaul@xxxxxxxxx>
Date: Tue, 20 Mar 2012 15:20:53 +0200
On Tue, Mar 20, 2012 at 3:19 PM, Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> wrote:
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.

Yep, discovered that. My fault. Sorry for the noise.
Y.
 
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe