diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2010-10-08 01:17:04 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2010-10-08 01:17:04 +0000 |
commit | f8402031c595cd12b6573b8c8fb2a5c5ba953cec (patch) | |
tree | ae1563b9efdc2796269aebb6046f733d92afe3d9 /epan/dissectors/packet-vlan.c | |
parent | a179cfb90a95387c66a1e7b6914246c2b4d242f9 (diff) |
Don't use a TRY/CATCH block just to ignore any exceptions thrown by
tvb_get_ntohs(): check the remaining tvb length instead.
svn path=/trunk/; revision=34421
Diffstat (limited to 'epan/dissectors/packet-vlan.c')
-rw-r--r-- | epan/dissectors/packet-vlan.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c index 55cce0a6df..d545d14a80 100644 --- a/epan/dissectors/packet-vlan.c +++ b/epan/dissectors/packet-vlan.c @@ -139,16 +139,13 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) Ethernet VLAN packets). A non-0xffff value means that there's an 802.2 layer inside the VLAN layer */ is_802_2 = TRUE; - TRY { - if (tvb_get_ntohs(tvb, 4) == 0xffff) { - is_802_2 = FALSE; - } - } - CATCH2(BoundsError, ReportedBoundsError) { - ; /* do nothing */ + /* Don't throw an exception for this check (even a ReportedBoundsError) */ + if (tvb_length_remaining(tvb, 4) >= 2) { + if (tvb_get_ntohs(tvb, 4) == 0xffff) { + is_802_2 = FALSE; + } } - ENDTRY; dissect_802_3(encap_proto, is_802_2, tvb, 4, pinfo, tree, vlan_tree, hf_vlan_len, hf_vlan_trailer, 0); |