Wireshark-dev: Re: [Wireshark-dev] how to handle dissecting length encoded strings
From: Chris Maynard <chris.maynard@xxxxxxxxx>
Date: Mon, 14 Mar 2011 16:01:54 +0000 (UTC)
Fulko Hew <fulko.hew@...> writes:

> Comments anyone?

How about this patch?:

Index: epan/dissectors/packet-agentx.c
===================================================================
--- epan/dissectors/packet-agentx.c     (revision 36188)
+++ epan/dissectors/packet-agentx.c     (working copy)
@@ -308,8 +308,7 @@
        if (n_oct >= 1024)
                THROW(ReportedBoundsError);
        if (n_oct > 0)
-               tvb_get_nstringz(tvb, offset + 4, n_oct, context);
-       context[n_oct]='\0';
+               tvb_get_nstringz0(tvb, offset + 4, n_oct, context);

        proto_tree_add_uint(tree, hf_ostring_len, tvb, offset, 4, n_oct);
        proto_tree_add_string(tree, hf_ostring, tvb, offset + 4, n_oct, context)
;


- Chris