Wireshark mailing list archives

Re: Best way to handle a variable-length NULL-terminated string in a tvb


From: Jeremy O'Brien <obrien654j () gmail com>
Date: Sat, 8 May 2010 17:57:40 -0400

On May 3, 2010, at 11:32 AM, Maynard, Chris wrote:

Maybe this is what you're looking for?

From epan/tvbuff.h:

/** Find size of stringz (NUL-terminated string) by looking for terminating
* NUL.  The size of the string includes the terminating NUL.
*
* If the NUL isn't found, it throws the appropriate exception.
*/
extern guint tvb_strsize(tvbuff_t *tvb, const gint offset);

Even better. I was doing a g_free(tvb_get_stringz(tvb, offset, &length)); before. This saves me the trouble and the 
overhead. Thanks!
___________________________________________________________________________
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: