Wireshark mailing list archives

Re: Wireshark crashes on tvb_get_const_stringz()


From: Jakub Zawadzki <darkjames-ws () darkjames pl>
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.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: