aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ip.c
diff options
context:
space:
mode:
authorcmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>2011-11-21 02:01:59 +0000
committercmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>2011-11-21 02:01:59 +0000
commit244a3065139eae6c2314565c5b220934799b5493 (patch)
tree4edfc0681cce40fe421fee59081a80b8621d698d /epan/dissectors/packet-ip.c
parenta837c9b19c63b6a43903e30fa04ae20a8df2e464 (diff)
Fix potential infinite loop introduced with r39961 and find by the buildbot. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6599
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39963 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-ip.c')
-rw-r--r--epan/dissectors/packet-ip.c20
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;