diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2004-01-28 20:09:44 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2004-01-28 20:09:44 +0000 |
commit | e240750f6c218125a057b18e313668bae1d9d7e5 (patch) | |
tree | 0c57f91d7b4307e60a8769ff0aacb691c3121132 /packet-ethertype.c | |
parent | 1737eb33a426abd8b268f6526f9d03aceb226536 (diff) |
If we don't have any of the packet padding in the tvbuff, don't even try
to add the trailer - that avoids the problem with throwing an exception
inside a CATCH* clause for that same exception. (XXX - is this a
problem with our exception mechanism? What happens in languages with
built-in exceptions if a
try
XXX
catch YYY
ZZZ
end
construct throws exception YYY inside code block ZZZ? If it doesn't
re-enter ZZZ, that argues that our exception mechanism is buggy or, at
least, violates the Principle of Least Surprise.)
Move the code to put the trailer information into the protocol tree out
of the CATCH2 clause, so the trailer shows up if we *do* have the
trailer information.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9898 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ethertype.c')
-rw-r--r-- | packet-ethertype.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/packet-ethertype.c b/packet-ethertype.c index bb63134ff7..487864c310 100644 --- a/packet-ethertype.c +++ b/packet-ethertype.c @@ -1,7 +1,7 @@ /* ethertype.c * Routines for calling the right protocol for the ethertype. * - * $Id: packet-ethertype.c,v 1.42 2004/01/28 03:36:37 gerald Exp $ + * $Id: packet-ethertype.c,v 1.43 2004/01/28 20:09:44 guy Exp $ * * Gilbert Ramirez <gram@alumni.rice.edu> * @@ -263,22 +263,25 @@ add_dix_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, a trailer. */ if (length < length_before) { /* - * Create a tvbuff for the padding. + * Is any of the padding present in the tvbuff? */ - TRY { + if (tvb_offset_exists(tvb, offset_after_etype + length)) { + /* + * Yes - create a tvbuff for the padding. + */ trailer_tvb = tvb_new_subset(tvb, offset_after_etype + length, -1, -1); - } - CATCH2(BoundsError, ReportedBoundsError) { - /* The packet doesn't have "length" bytes worth of - captured data left in it. No trailer to display. */ + } else { + /* + * No - don't bother showing the trailer. + * XXX - show a Short Frame indication? + */ trailer_tvb = NULL; - add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); } - ENDTRY; } else trailer_tvb = NULL; /* no trailer */ + add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); } void |