Wireshark-dev: Re: [Wireshark-dev] header field arrays
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 18 Jun 2009 15:02:39 -0700

On Jun 18, 2009, at 1:43 PM, Jonathan Walker (c) wrote:

When creating and registering a new header field array in a plug- in, does the size of the array have to be exactly the same as the number of used fields?

No. This is C, not PL/I :-), so if you pass an array (which really means passing a pointer to the first element of the array) to a function, the function has no idea how big the array actually is.

For example, I created a hf array as follows:

      static hf_register_info hf[MAX_FIELDS];

I plan to fill up a certain variable amount of fields (up to “cur_field”) less than MAX_FIELDS, and then register the first cur_field amount of values of the array as follows:

      proto_register_field_array(proto_shsip, hf, cur_field);

However, I’m getting a run-time error upon trying to click a field in Wireshark, and I was wondering if this is the problem.

Probably not.  What is the run-time error?