Ethereal-dev: [Ethereal-dev] BoundsError exception in text MEGACO packets

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Tarlovskij Eugene" <eugene@xxxxxxxxxxxx>
Date: Wed, 31 May 2006 13:42:57 +0400
The second problem with MEGACO I've found is here. It is an exception
raising when MEGACO dissector parses audit packets.

Sample audit packet looks like this:

MEGACO/1 <company2.com>:2944
Transaction=6438{
    Context=*{
        AuditValue=user_6{Audit{Media}}
    }
}

The dissector encounters "Audit" descriptor (dissect_megaco_auditdescriptor
function) and calls dissect_megaco_descriptors() from it.
dissect_megaco_descriptors(), in turn, detects word "Media" and passes
control to dissect_megaco_mediadescriptor().

What happens inside dissect_megaco_mediadescriptor() ? The dissector tries
to find "=" character after the word "Media" which is incorrect in this
case.

I've made "quick-n-dirty" fix avoiding tvb_format_text() call if length
parameter less or equal than zero.

Please tell me am I right or wrong with it. I did not committed it to
repository because I'm not sure it is correct way to solve the problem.


Index: packet-megaco.c
===================================================================
--- packet-megaco.c	(revision 18189)
+++ packet-megaco.c	(working copy)
@@ -1346,8 +1346,9 @@
 
 	tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset,
tvb_RBRKT, '=');
 	tokenlen = tvb_current_offset  - tvb_previous_offset -1;
-	proto_tree_add_text(megaco_mediadescriptor_tree, tvb,
tvb_previous_offset, tokenlen,
-		"%s",	tvb_format_text(tvb, tvb_previous_offset,
tokenlen));
+	if (tokenlen > 0)
+		proto_tree_add_text(megaco_mediadescriptor_tree, tvb,
tvb_previous_offset, tokenlen,
+			"%s",	tvb_format_text(tvb, tvb_previous_offset,
tokenlen));
 
 	tvb_next_offset = tvb_find_guint8(tvb, tvb_previous_offset,
tvb_RBRKT, '{');
 	/* If a StreamID is present */




Eugene Tarlovskij


_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev