diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-11-13 05:22:58 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-11-13 05:22:58 +0000 |
commit | 22adc6fb73435e1838d2e772dc07c331383e9d3e (patch) | |
tree | 1db08ae8ca23a695c8323decb8ff42040e8c04cd /packet-vlan.c | |
parent | ee837299c55701f67b8dfbf65cb0bbb88e240c39 (diff) |
If either of the "tvb_new_subset()" calls throws an exception, it means
we don't have so much data in the frame that there's a trailer, so we
should set "trailer_tvb" to NULL.
Put in a comment explaining what the exception catching is all about.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2632 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-vlan.c')
-rw-r--r-- | packet-vlan.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packet-vlan.c b/packet-vlan.c index d52c7e714a..adcbfdb96d 100644 --- a/packet-vlan.c +++ b/packet-vlan.c @@ -1,7 +1,7 @@ /* packet-vlan.c * Routines for VLAN 802.1Q ethernet header disassembly * - * $Id: packet-vlan.c,v 1.22 2000/11/13 04:44:14 guy Exp $ + * $Id: packet-vlan.c,v 1.23 2000/11/13 05:22:58 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -114,7 +114,25 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) trailer_tvb = tvb_new_subset(tvb, 4 + encap_proto, -1, -1); } CATCH2(BoundsError, ReportedBoundsError) { + /* Either: + + the packet doesn't have "encap_proto" bytes worth of + captured data left in it - or it may not even have + "encap_proto" bytes worth of data in it, period - + so the "tvb_new_subset()" creating "next_tvb" + threw an exception + + or + + the packet has exactly "encap_proto" bytes worth of + captured data left in it, so the "tvb_new_subset()" + creating "trailer_tvb" threw an exception. + + In either case, this means that all the data in the frame + is within the length value, so we give all the data to the + next protocol and have no trailer. */ next_tvb = tvb_new_subset(tvb, 4, -1, encap_proto); + trailer_tvb = NULL; } ENDTRY; |