Ethereal-dev: [Ethereal-dev] [Patch] to fix part of bug 857 (MGCP decode issue)

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

From: Martin Mathieson <martin.mathieson@xxxxxxxxxxxx>
Date: Wed, 05 Apr 2006 14:20:58 +0100
Hi,

This patch fixes the decode problem mentioned in this bug report:

"3. Frames 9 and 13 are only partially decoded and show up as "Packet size
limited during capture" It looks like the decode chokes on the DQ-RI line."

DQ-RI is a localconnectionoptions parameter and shouldn't appear as a top-level parameter.
This patch makes sure that all of the single-character top-level parmeter codes are followed immediately by a ':'.

Regards,
Martin

Index: plugins/mgcp/packet-mgcp.c
===================================================================
--- plugins/mgcp/packet-mgcp.c	(revision 17810)
+++ plugins/mgcp/packet-mgcp.c	(working copy)
@@ -1072,12 +1072,27 @@
 		switch (tempchar)
 		{
 			case 'K':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_rspack;
 				break;
 			case 'B':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_bearerinfo;
 				break;
 			case 'C':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_callid;
 				break;
 			case 'I':
@@ -1095,6 +1110,11 @@
 				}
 				break;
 			case 'N':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_notifiedentity;
 				break;
 			case 'X':
@@ -1142,6 +1162,11 @@
 				}
 				break;
 			case 'L':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_localconnoptions;
 				break;
 			case 'M':
@@ -1178,14 +1203,29 @@
 				}
 				break;
 			case 'S':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_signalreq;
 				buf = &(mi->signalReq);
 				break;
 			case 'D':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_digitmap;
 				mi->hasDigitMap = TRUE;
 				break;
 			case 'O':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_observedevent;
 				buf = &(mi->observedEvents);
 				break;
@@ -1232,15 +1272,35 @@
 				}
 				break;
 			case 'F':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_reqinfo;
 				break;
 			case 'Q':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_quarantinehandling;
 				break;
 			case 'T':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_detectedevents;
 				break;
 			case 'A':
+				if (tvb_get_guint8(tvb,tvb_current_offset+1) != ':')
+				{
+					*hf = &hf_mgcp_param_invalid;
+					break;
+				}
 				*hf = &hf_mgcp_param_capabilities;
 				break;