aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/megaco/packet-megaco.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/megaco/packet-megaco.c')
-rw-r--r--plugins/megaco/packet-megaco.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/megaco/packet-megaco.c b/plugins/megaco/packet-megaco.c
index 9ea08b20af..7e0d608755 100644
--- a/plugins/megaco/packet-megaco.c
+++ b/plugins/megaco/packet-megaco.c
@@ -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;