Wireshark-dev: Re: [Wireshark-dev] Should we check value_strings for NULL termination while reg

From: "Gilbert Ramirez" <gram@xxxxxxxxxxxxxxx>
Date: Wed, 20 Sep 2006 10:50:01 -0500
I believe we do this in the build-bot testing, by doing:

tshark -G values

Since that operation iterates across all the value_string arrays, a
non-terminated array will result in an error .... or at least it
should.

Is that enough testing?

--gilbert

On 9/20/06, Ulf Lamping <ulf.lamping@xxxxxx> wrote:
Hi List!

It seems to be a common mistake to forget the terminating zero entry in a value_string, I've done this myself before and it's hard to track it down if you don't have a clue what's going wrong.

Even worse, this mistake might not make any problems for a long time as usually the values rushing in will be in the value_string (I've found my mistake by fuzz-testing).

We could automatically check the termination of the value_string (at least for the registered values) while registering the hf_ values. This will indicate the problem a lot earlier and at the place where it's caused (and not much, much later).

Of cause this has a drawback: Iterating trough all value_strings at registration will take a little bit of time at startup (didn't tried so don't know how long this will take).

What do others think: Is the added time overhead worth adding some extra robustness or are there other mechanisms possible to detect these kind of errors (e.g. static code analysis)?

Regards, ULFL
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066

_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev