Joerg Mayer wrote:
On Tue, Aug 23, 2005 at 08:34:21AM +0000, guy@xxxxxxxxxxxx wrote:
Log:
Use "format_text()" and "tvb_format_text()" when displaying strings.
(It's not necessary, or desirable, to use them when fetching strings.)
Nice :-)
In the long term we need to handle strings differently, to support
multiple character encodings - see the first item under "Dissector
infrastructure" on the
http://wiki.ethereal.com/Development/Wishlist
page - and part of that should include handling not only the display of
non-ASCII printable characters in those encodings, but also the handling
of non-printable characters.
In the short term, using "format_text()" and "tvb_format_text()"
whenever printing a string with "%s" (or "%.*s", which those routines
render unnecessary) keeps random non-printable characters from showing
up in printouts (and also flags locations that, in the long term, would
be changed to format the string appropriately for its encoding).
When processing a VLAN TLV, check the length of the TLV, so we don't end
up running past the end of the TLV and getting a negative remaining
length.
This cannot happen because the main loop checks that at least 4 bytes for
the tlv are available - or did I misunderstand something?
The length won't go negative when you subtract 4 from it - but it can go
negative if you subtract more from it, as can happen when it's
dissecting the VLAN name.
Append to the protocol tree item for the TLV, and the Info
column, as we dissect the VLAN ID and VLAN name fields.
Well, I was too lazy for that, and since nobody requested it ;->
It was already putting that information into the protocol tree item for
the entire TLV and in the Info column; my only change was to append the
VLAN ID at the same time we add it to the protocol tree, rather than
fetching it earlier (so that if the packet is cut off after the TLV
header but before the VLAN ID, it'll at least dissct the TLV header) and
to do the same with the VLAN name.