diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-09-17 12:13:34 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-09-17 12:13:34 +0000 |
commit | 8e74cd8d16cf214d26ee637a2eba9a8d3a0e7a1f (patch) | |
tree | c55fd6e9a2aa64a77d56e07d52d975f0ab5a3b99 /epan/dissectors | |
parent | 9db969ded196dcdc942f961cbdf400dc281e973e (diff) |
Fix errors in the packet length checks.
svn path=/trunk/; revision=44939
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-ip.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 716414144b..753a8245d6 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -2479,7 +2479,7 @@ dissect_ip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data return FALSE; } tot_length = tvb_get_ntohs(tvb,4); - if(tot_length != 40 + (int)tvb_reported_length(tvb)){ + if((tot_length + 40) != (int)tvb_reported_length(tvb)){ return FALSE; } call_dissector(ipv6_handle, tvb, pinfo, tree); @@ -2489,9 +2489,12 @@ dissect_ip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data if((version != 4)|| (ihl < 5)){ return FALSE; } + /* Total Length is the length of the datagram, measured in octets, + * including internet header and data. + */ tot_length = tvb_get_ntohs(tvb,2); - if(tot_length != 8 + (int)tvb_reported_length(tvb)){ + if(tot_length != (int)tvb_reported_length(tvb)){ return FALSE; } |