diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2011-11-21 02:01:59 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2011-11-21 02:01:59 +0000 |
commit | f2e8579ba375ef960209214fe432afd3bb3f83b1 (patch) | |
tree | 4edfc0681cce40fe421fee59081a80b8621d698d /epan/dissectors/packet-ip.c | |
parent | 3c8e31e0557a75c4992c2685a6c0be090c1ac4dd (diff) |
Fix potential infinite loop introduced with r39961 and find by the buildbot. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6599
svn path=/trunk/; revision=39963
Diffstat (limited to 'epan/dissectors/packet-ip.c')
-rw-r--r-- | epan/dissectors/packet-ip.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index cfdd0a7e3d..56533aabb3 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1293,16 +1293,18 @@ get_dst_offset(tvbuff_t *tvb, int offset, guint length, /* Bogus - option length is less than what it's supposed to be for this option. */ return 0; - } else if (optp != NULL) { - if (opt == IPOPT_SSRR || opt == IPOPT_LSRR) { - /* Hmm, what if you have both options? */ - guint8 ptr; - - ptr = tvb_get_guint8(tvb, offset + 2); - if (ptr < 4 || (ptr & 3) || (ptr > len)) { - return 0; + } else { + if (optp != NULL) { + if (opt == IPOPT_SSRR || opt == IPOPT_LSRR) { + /* Hmm, what if you have both options? */ + guint8 ptr; + + ptr = tvb_get_guint8(tvb, offset + 2); + if (ptr < 4 || (ptr & 3) || (ptr > len)) { + return 0; + } + return (offset - orig_offset) + 4 + (len - 4); } - return (offset - orig_offset) + 4 + (len - 4); } len -= 2; /* subtract size of type and length */ offset += 2 + len; |