Re: Dissecting with variable length fields

Kees Cook <[email protected]>
Newsgroups gmane.network.ethereal.devel
Message-ID <[email protected]>
On Fri, May 26, 2006 at 03:31:58PM -0700, Stephen Fisher wrote:
> I am writing a new dissector for the exec/rexec protocol and am new to 
> Ethereal development.  What is the best way to dissect a protocol whose 
> fields are variable length null terminated strings?

tvb_get_stringz() works great for this.  See doc/README.developer:

guint8 *tvb_get_stringz(tvbuff_t *tvb, gint offset, gint *lengthp);
guint8 *tvb_get_ephemeral_stringz(tvbuff_t *tvb, gint offset, gint *lengthp);

-- 
Kees Cook                                            @outflux.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.