Ethereal-dev: [Ethereal-dev] Q.931 fails to pass long message to H.225 [PATCH]

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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Wed, 30 Nov 2005 00:20:30 +0100 (CET)
Hi,

In light of this discussion here:
http://www.ethereal.com/lists/ethereal-dev/200511/msg00283.html
can the attached patch go in, or should I just drop it?

Thanx,
Jaap


Index: epan/dissectors/packet-q931.c
===================================================================
--- epan/dissectors/packet-q931.c	(revision 16625)
+++ epan/dissectors/packet-q931.c	(working copy)
@@ -45,6 +45,10 @@
 #include <epan/lapd_sapi.h>
 #include "packet-tpkt.h"
 
+#ifndef min
+#define min(a,b) (((a)<(b))?(a):(b))
+#endif
+
 /* Q.931 references:
  *
  * http://www.acacia-net.com/Clarinet/Protocol/q9313svn.htm
@@ -2625,6 +2629,13 @@
 
 			if (info_element_len > 1) {
 				/*
+				 * If we don't desegment limit the length 
+				 * to the actual size in the frame
+				 */
+				if (!pinfo->can_desegment) {
+					info_element_len = min(info_element_len, tvb_length_remaining(tvb, offset + 4));
+				}
+				/*
 				 * Do we have a handle for the H.225
 				 * dissector?
 				 */