aboutsummaryrefslogtreecommitdiffstats
path: root/packet-eth.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-11-13 05:28:00 +0000
committerGuy Harris <guy@alum.mit.edu>2000-11-13 05:28:00 +0000
commit796997a538eede8129af9fbb938b3b1cc8bc719d (patch)
tree93719b11063208d44c525613eb277d6ac1a9998e /packet-eth.c
parentee5b7e05ff6b4a24c8201e8ef5191950761ab9c6 (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. svn path=/trunk/; revision=2633
Diffstat (limited to 'packet-eth.c')
-rw-r--r--packet-eth.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/packet-eth.c b/packet-eth.c
index 5624e80322..1f343ed732 100644
--- a/packet-eth.c
+++ b/packet-eth.c
@@ -1,7 +1,7 @@
/* packet-eth.c
* Routines for ethernet packet disassembly
*
- * $Id: packet-eth.c,v 1.45 2000/11/13 05:11:16 guy Exp $
+ * $Id: packet-eth.c,v 1.46 2000/11/13 05:28:00 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -266,7 +266,25 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
trailer_tvb = tvb_new_subset(tvb, ETH_HEADER_SIZE + etype, -1, -1);
}
CATCH2(BoundsError, ReportedBoundsError) {
+ /* Either:
+
+ the packet doesn't have "etype" bytes worth of
+ captured data left in it - or it may not even have
+ "etype" bytes worth of data in it, period -
+ so the "tvb_new_subset()" creating "next_tvb"
+ threw an exception
+
+ or
+
+ the packet has exactly "etype" 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, ETH_HEADER_SIZE, -1, etype);
+ trailer_tvb = NULL;
}
ENDTRY;
}