Wireshark mailing list archives

Re: pcapng, must opt_comment string be 0-terminated?


From: Guy Harris <guy () alum mit edu>
Date: Sun, 1 Jan 2012 18:53:52 -0800


On Jan 1, 2012, at 3:00 PM, Martin Kaiser wrote:

In a pcapng file, does the string stored in an opt_comment option have
to be 0-terminated? I couldn't find anything explicit about this in the
specification. Pcapng options have a length field, therefore I'd guess
the 0 termination is not required. What do you think?

The Wireshark code to read pcap-NG files uses g_strndup() to make copies of the various "UTF-8 string[s]", so the 
strings in the file don't have to be null-terminated, and I would read the *lack* of any mention of null-termination in 
the spec as an indication that they don't have to be null-terminated.

I'll send the spec maintainers a note asking about this, and suggesting that the spec indicate that all strings are 
counted (but shouldn't contain a null byte).
___________________________________________________________________________
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: