Break out of an infinite loop. Fixes bug 95.
authorGerald Combs <gerald@wireshark.org>
Wed, 27 Apr 2005 19:09:55 +0000 (19:09 -0000)
committerGerald Combs <gerald@wireshark.org>
Wed, 27 Apr 2005 19:09:55 +0000 (19:09 -0000)
svn path=/trunk/; revision=14204

plugins/megaco/packet-megaco.c

index 9ea08b20af77e3bc9e0b12137fa1597b1aa0ccf8..7e0d60875538b7ae2226eab779ae06d9494570c8 100644 (file)
@@ -598,8 +598,13 @@ nextcontext:
                tvb_previous_offset = tvb_find_guint8(tvb, tvb_current_offset,
                        tvb_len, '=')+1;
                tvb_previous_offset = tvb_skip_wsp(tvb, tvb_previous_offset);
-               tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset,
+               tvb_next_offset = tvb_find_guint8(tvb, tvb_previous_offset,
                        tvb_len, '{');
+               if (tvb_current_offset >= tvb_next_offset) {
+                       proto_tree_add_text(megaco_tree, tvb, 0, 0, "[ Parse error: Invalid offset ]");
+                       return;
+               }
+               tvb_current_offset = tvb_next_offset;
                
                
                tokenlen = tvb_current_offset - tvb_previous_offset;