Provide tvb_ensure_length_remaining(), which is like
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 1 Feb 2002 04:34:17 +0000 (04:34 +0000)
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 1 Feb 2002 04:34:17 +0000 (04:34 +0000)
tvb_length_remaining() except that it throws BoundsError if 'offset'
is out-of-bounds.

Allow a length argument of -1 for FT_STRING and FT_BYTES fields
in proto_tree_add_item().

Change some dissectors to either use -1 for the length argument in
calls to proto_tree_add_item(), or call tvb_ensure_length_remaining()
instead of tvb_length_remaining(), or to check the return-value
of tvb_length_remaining(). Changes to more dissectors are necessary,
but will follow later.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4656 f5534014-38df-0310-8fa8-9805f1628bb7

epan/proto.c
epan/tvbuff.c
epan/tvbuff.h
packet-afs.c
packet-auto_rp.c
packet-beep.c
packet-eigrp.c
packet-h261.c
packet-isup.c
packet-mpeg1.c
packet-tns.c

index cb8bcb4ceb93d60616da8d34e0f6dd19b197cc64..46a782620546fc86d4a98173cb6d63b787560224 100644 (file)
@@ -1,7 +1,7 @@
 /* proto.c
  * Routines for protocol tree
  *
- * $Id: proto.c,v 1.50 2002/01/20 22:12:39 guy Exp $
+ * $Id: proto.c,v 1.51 2002/02/01 04:34:17 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1167,6 +1167,10 @@ proto_tree_set_string_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length
 {
        gchar   *string;
 
+       if (length == -1) {
+               length = tvb_ensure_length_remaining(tvb, start);
+       }
+
        /* This memory is freed in proto_tree_free_node() */
        string = g_malloc(length + 1);
        tvb_memcpy(tvb, string, start, length);
@@ -1624,8 +1628,10 @@ alloc_field_info(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint
                 * It's not valid for any other type of field.
                 */
                g_assert(hfinfo->type == FT_PROTOCOL ||
-                        hfinfo->type == FT_NONE);
-               length = tvb_length_remaining(tvb, start);
+                        hfinfo->type == FT_NONE ||
+                        hfinfo->type == FT_BYTES ||
+                        hfinfo->type == FT_STRING);
+               length = tvb_ensure_length_remaining(tvb, start);
        }
 
        fi = g_mem_chunk_alloc(gmc_field_info);
index d24643e243cf8c3cb1cb54b26be8217959fcfdbe..163a4bd90dad4db753a2a55ccbf108ab59552cd8 100644 (file)
@@ -9,7 +9,7 @@
  *             the data of a backing tvbuff, or can be a composite of
  *             other tvbuffs.
  *
- * $Id: tvbuff.c,v 1.27 2002/01/04 06:45:14 gram Exp $
+ * $Id: tvbuff.c,v 1.28 2002/02/01 04:34:17 gram Exp $
  *
  * Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
  *
@@ -606,6 +606,22 @@ tvb_length_remaining(tvbuff_t *tvb, gint offset)
        }
 }
 
+gint
+tvb_ensure_length_remaining(tvbuff_t *tvb, gint offset)
+{
+       gint retval;
+
+       retval = tvb_length_remaining(tvb, offset);
+
+       if (retval == -1) {
+               THROW(ReportedBoundsError);
+       }
+       else {
+               return retval;
+       }
+}
+
+
 
 
 /* Validates that 'length' bytes are available starting from
index 08403b50110f10e11973364f92241ce0b9474e28..2de3f6365064f9e5f8aef8f62ae6e8ec9d2fc3d3 100644 (file)
@@ -9,7 +9,7 @@
  *             the data of a backing tvbuff, or can be a composite of
  *             other tvbuffs.
  *
- * $Id: tvbuff.h,v 1.20 2001/11/20 22:46:12 guy Exp $
+ * $Id: tvbuff.h,v 1.21 2002/02/01 04:34:17 gram Exp $
  *
  * Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
  *
@@ -192,6 +192,9 @@ extern guint tvb_length(tvbuff_t*);
  * indicate that offset is out of bounds. No exception is thrown. */
 extern gint tvb_length_remaining(tvbuff_t*, gint offset);
 
+/* Same as above, but throws BoundsError if the offset is out of bounds. */
+extern gint tvb_ensure_length_remaining(tvbuff_t*, gint offset);
+
 /* Checks (w/o throwing exception) that the bytes referred to by
  * 'offset'/'length' actually exist in the buffer */
 extern gboolean tvb_bytes_exist(tvbuff_t*, gint offset, gint length);
index 81c49a9e4b146f8dec47fbd95c60df1d722eecf7..04485c4310f67ea6cea61125a0ad6fb39fea4f2b 100644 (file)
@@ -8,7 +8,7 @@
  * Portions based on information/specs retrieved from the OpenAFS sources at
  *   www.openafs.org, Copyright IBM. 
  *
- * $Id: packet-afs.c,v 1.40 2002/01/24 09:20:46 guy Exp $
+ * $Id: packet-afs.c,v 1.41 2002/02/01 04:34:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -56,7 +56,7 @@
 #include "packet-afs-defs.h"
 #include "packet-afs-macros.h"
 
-#define GETSTR tvb_get_ptr(tvb,offset,tvb_length_remaining(tvb,offset))
+#define GETSTR tvb_get_ptr(tvb,offset,tvb_ensure_length_remaining(tvb,offset))
 
 #define VALID_OPCODE(opcode) ((opcode >= OPCODE_LOW && opcode <= OPCODE_HIGH) || \
                (opcode >= VOTE_LOW && opcode <= VOTE_HIGH) || \
index 683e214ee7567d1bad99573ba671de3fcdc95ec4..d90a20bf99c4de4886ca5ae7a804413ba61e62cc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Heikki Vatiainen <hessu@cs.tut.fi>
  *
- * $Id: packet-auto_rp.c,v 1.18 2002/01/24 09:20:47 guy Exp $
+ * $Id: packet-auto_rp.c,v 1.19 2002/02/01 04:34:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -169,7 +169,7 @@ static void dissect_auto_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                         offset = do_auto_rp_map(tvb, offset, auto_rp_tree);
 
                 if (tvb_length_remaining(tvb, offset) > 0)
-                        proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Trailing junk");
+                        proto_tree_add_text(tree, tvb, offset, -1, "Trailing junk");
         }
 
         return;
index 1cd338ec5fe6f40502cd59e09f2c223c074f6cae..2507f2995fc39a1c74ab3ae0565f36c82042dae6 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-beep.c
  * Routines for BEEP packet disassembly
  *
- * $Id: packet-beep.c,v 1.4 2002/01/24 09:20:47 guy Exp $
+ * $Id: packet-beep.c,v 1.5 2002/02/01 04:34:15 gram Exp $
  *
  * Copyright (c) 2000 by Richard Sharpe <rsharpe@ns.aus.com>
  * Modified 2001 Darren New <dnew@invisible.net> for BEEP.
@@ -395,7 +395,7 @@ static int header_len(tvbuff_t *tvb, int offset)
 
   while (1) {
 
-    if (tvb_length_remaining(tvb, offset + i) < 1)
+    if (tvb_ensure_length_remaining(tvb, offset + i) < 1)
       return i;   /* Not enough characters left ... */
 
     if ((sc = tvb_get_guint8(tvb, offset + i)) == 0x0d 
index 5a7fd7644d2ef0f460d811ded15b827d521da3ab..7eaa3fb732c255cb984a3f2b6cb5b94e4a3686bc 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for EIGRP dissection
  * Copyright 2000, Paul Ionescu <paul@acorp.ro>
  *
- * $Id: packet-eigrp.c,v 1.21 2002/01/24 09:20:47 guy Exp $
+ * $Id: packet-eigrp.c,v 1.22 2002/02/01 04:34:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -191,7 +191,7 @@ dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
             size =  tvb_get_ntohs(tvb,offset+2);
             if ( size == 0 ) 
                {
-               proto_tree_add_text(eigrp_tree,tvb,offset,tvb_length_remaining(tvb,offset),"Unknown data (maybe authentication)");
+               proto_tree_add_text(eigrp_tree,tvb,offset,-1,"Unknown data (maybe authentication)");
                return;
                }
 
index 8e5e5a7982d5ce8596e631c7f2c3e62c5e897404..cd75117f691f4a0899af7ae2a0b82e86a2eb8585 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Routines for ITU-T Recommendation H.261 dissection
  *
- * $Id: packet-h261.c,v 1.13 2002/01/29 17:18:06 gram Exp $
+ * $Id: packet-h261.c,v 1.14 2002/02/01 04:34:15 gram Exp $
  * 
  * Copyright 2000, Philips Electronics N.V.
  * Andreas Sikkema <andreas.sikkema@philips.com>
@@ -117,7 +117,7 @@ dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
                offset++;
 
                /* The rest of the packet is the H.261 stream */
-               proto_tree_add_item( h261_tree, hf_h261_data, tvb, offset, tvb_length_remaining( tvb, offset ), FALSE );
+               proto_tree_add_item( h261_tree, hf_h261_data, tvb, offset, -1, FALSE );
        }
 }
 
index 7133ed2b26798b741454205758c5407afd8031be..79632cfc6cc4ce6e23ef0540df52e51c308fd6d5 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for ISUP dissection
  * Copyright 2001, Martina Obermeier <martina.obermeier@icn.siemens.de>
  *
- * $Id: packet-isup.c,v 1.10 2002/01/31 00:49:59 guy Exp $
+ * $Id: packet-isup.c,v 1.11 2002/02/01 04:34:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1299,8 +1299,7 @@ void dissect_isup_called_party_number_parameter(tvbuff_t *parameter_tvb, proto_t
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Called Party Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1346,8 +1345,7 @@ void dissect_isup_subsequent_number_parameter(tvbuff_t *parameter_tvb, proto_tre
   offset = 1;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Subsequent Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1641,8 +1639,7 @@ dissect_isup_calling_party_number_parameter(tvbuff_t *parameter_tvb, proto_tree
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Calling Party Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1693,8 +1690,7 @@ dissect_isup_original_called_number_parameter(tvbuff_t *parameter_tvb, proto_tre
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Original Called Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1745,8 +1741,7 @@ dissect_isup_redirecting_number_parameter(tvbuff_t *parameter_tvb, proto_tree *p
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Redirecting Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1796,8 +1791,7 @@ void dissect_isup_redirection_number_parameter(tvbuff_t *parameter_tvb, proto_tr
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Redirection Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1939,8 +1933,7 @@ dissect_isup_connected_number_parameter(tvbuff_t *parameter_tvb, proto_tree *par
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Connected Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -1989,8 +1982,7 @@ dissect_isup_transit_network_selection_parameter(tvbuff_t *parameter_tvb, proto_
   offset = 1;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Network identification");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -2332,8 +2324,7 @@ dissect_isup_location_number_parameter(tvbuff_t *parameter_tvb, proto_tree *para
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Location number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -2439,8 +2430,7 @@ dissect_isup_call_transfer_number_parameter(tvbuff_t *parameter_tvb, proto_tree
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Call transfer number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -2580,8 +2570,7 @@ dissect_isup_called_in_number_parameter(tvbuff_t *parameter_tvb, proto_tree *par
   offset = 2;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Called IN Number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -2728,8 +2717,7 @@ dissect_isup_generic_number_parameter(tvbuff_t *parameter_tvb, proto_tree *param
   offset = 3;
 
   address_digits_item = proto_tree_add_text(parameter_tree, parameter_tvb,
-                                           offset,
-                                           tvb_length_remaining(parameter_tvb, offset),
+                                           offset, -1,
                                            "Generic number");
   address_digits_tree = proto_item_add_subtree(address_digits_item, ett_isup_address_digits);
 
@@ -3087,7 +3075,7 @@ dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tre
                                       "Nature of Connection Indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(NATURE_OF_CONNECTION_IND_LENGTH, actual_length), NATURE_OF_CONNECTION_IND_LENGTH);
   dissect_isup_nature_of_connection_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += NATURE_OF_CONNECTION_IND_LENGTH;
@@ -3099,7 +3087,7 @@ dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tre
                                       "Forward Call Indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset); 
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset); 
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FORWARD_CALL_IND_LENGTH, actual_length), FORWARD_CALL_IND_LENGTH );
   dissect_isup_forward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset +=  FORWARD_CALL_IND_LENGTH;
@@ -3111,7 +3099,7 @@ dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tre
                                       "Calling Party's category");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset); 
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset); 
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CALLING_PRTYS_CATEGORY_LENGTH, actual_length),CALLING_PRTYS_CATEGORY_LENGTH );
   dissect_isup_calling_partys_category_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += CALLING_PRTYS_CATEGORY_LENGTH;
@@ -3123,7 +3111,7 @@ dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tre
                                       "Transmission medium requirement");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));                     
-  actual_length = tvb_length_remaining(message_tvb, offset); 
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset); 
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH, actual_length), TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH);
   dissect_isup_transmission_medium_requirement_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += TRANSMISSION_MEDIUM_REQUIREMENT_LENGTH;
@@ -3142,7 +3130,7 @@ dissect_isup_initial_address_message(tvbuff_t *message_tvb, proto_tree *isup_tre
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_called_party_number_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3173,7 +3161,7 @@ gint dissect_isup_subsequent_address_message(tvbuff_t *message_tvb, proto_tree *
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_subsequent_number_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3199,7 +3187,7 @@ dissect_isup_information_request_message(tvbuff_t *message_tvb, proto_tree *isup
                                       "Information request indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_REQUEST_IND_LENGTH, actual_length), INFO_REQUEST_IND_LENGTH);
   dissect_isup_information_request_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += INFO_REQUEST_IND_LENGTH;
@@ -3223,7 +3211,7 @@ dissect_isup_information_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
                                       "Information indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(INFO_IND_LENGTH, actual_length), INFO_IND_LENGTH);
   dissect_isup_information_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += INFO_IND_LENGTH;
@@ -3247,7 +3235,7 @@ dissect_isup_continuity_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
                                       "Continuity indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CONTINUITY_IND_LENGTH, actual_length), CONTINUITY_IND_LENGTH);
   dissect_isup_continuity_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += CONTINUITY_IND_LENGTH;
@@ -3271,7 +3259,7 @@ dissect_isup_address_complete_message(tvbuff_t *message_tvb, proto_tree *isup_tr
                                       "Backward Call Indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += BACKWARD_CALL_IND_LENGTH;
@@ -3295,7 +3283,7 @@ dissect_isup_connect_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
                                       "Backward Call Indicators");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(BACKWARD_CALL_IND_LENGTH, actual_length), BACKWARD_CALL_IND_LENGTH);
   dissect_isup_backward_call_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += BACKWARD_CALL_IND_LENGTH;
@@ -3326,7 +3314,7 @@ dissect_isup_release_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3351,7 +3339,7 @@ dissect_isup_suspend_resume_message(tvbuff_t *message_tvb, proto_tree *isup_tree
                                       "Suspend/Resume indicator");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(SUSPEND_RESUME_IND_LENGTH, actual_length), SUSPEND_RESUME_IND_LENGTH);
   dissect_isup_suspend_resume_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += SUSPEND_RESUME_IND_LENGTH;
@@ -3382,7 +3370,7 @@ dissect_isup_circuit_group_reset_query_message(tvbuff_t *message_tvb, proto_tree
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3407,7 +3395,7 @@ dissect_isup_circuit_group_blocking_messages(tvbuff_t *message_tvb, proto_tree *
                                       "Circuit group supervision message type");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(CIRC_GRP_SV_MSG_TYPE_LENGTH, actual_length), CIRC_GRP_SV_MSG_TYPE_LENGTH);
   dissect_isup_circuit_group_supervision_message_type_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += CIRC_GRP_SV_MSG_TYPE_LENGTH;
@@ -3426,7 +3414,7 @@ dissect_isup_circuit_group_blocking_messages(tvbuff_t *message_tvb, proto_tree *
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3452,7 +3440,7 @@ dissect_isup_facility_request_accepted_message(tvbuff_t *message_tvb, proto_tree
                                       "Facility indicator");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += FACILITY_IND_LENGTH;
@@ -3476,7 +3464,7 @@ dissect_isup_facility_reject_message(tvbuff_t *message_tvb, proto_tree *isup_tre
                                       "Facility indicator");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(FACILITY_IND_LENGTH, actual_length), FACILITY_IND_LENGTH);
   dissect_isup_facility_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += FACILITY_IND_LENGTH;
@@ -3495,7 +3483,7 @@ dissect_isup_facility_reject_message(tvbuff_t *message_tvb, proto_tree *isup_tre
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3527,7 +3515,7 @@ dissect_isup_circuit_group_reset_acknowledgement_message(tvbuff_t *message_tvb,
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3559,7 +3547,7 @@ dissect_isup_circuit_group_query_response_message(tvbuff_t *message_tvb, proto_t
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_range_and_status_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3578,7 +3566,7 @@ dissect_isup_circuit_group_query_response_message(tvbuff_t *message_tvb, proto_t
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_circuit_state_ind_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3603,7 +3591,7 @@ dissect_isup_call_progress_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
                                       "Event information");
   parameter_tree = proto_item_add_subtree(parameter_item, ett_isup_parameter);
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));              
-  actual_length = tvb_length_remaining(message_tvb, offset);
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);
   parameter_tvb = tvb_new_subset(message_tvb, offset, MIN(EVENT_INFO_LENGTH, actual_length), EVENT_INFO_LENGTH);
   dissect_isup_event_information_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += EVENT_INFO_LENGTH;
@@ -3634,7 +3622,7 @@ dissect_isup_user_to_user_information_message(tvbuff_t *message_tvb, proto_tree
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_user_to_user_information_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3666,7 +3654,7 @@ dissect_isup_confusion_message(tvbuff_t *message_tvb, proto_tree *isup_tree)
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_type, message_tvb, 0, 0, parameter_type, "Mandatory Parameter: %u (%s)", parameter_type, val_to_str(parameter_type, isup_parameter_type_value,"unknown"));      
   proto_tree_add_uint_format(parameter_tree, hf_isup_mandatory_variable_parameter_pointer, message_tvb, offset, PARAMETER_POINTER_LENGTH, parameter_pointer, "Pointer to Parameter: %u", parameter_pointer);  
   proto_tree_add_uint_format(parameter_tree, hf_isup_parameter_length, message_tvb, offset + parameter_pointer, PARAMETER_LENGTH_IND_LENGTH, parameter_length, "Parameter length: %u", parameter_length);
-  actual_length = tvb_length_remaining(message_tvb, offset);          
+  actual_length = tvb_ensure_length_remaining(message_tvb, offset);           
   parameter_tvb = tvb_new_subset(message_tvb, offset + parameter_pointer + PARAMETER_LENGTH_IND_LENGTH, MIN(parameter_length, actual_length), parameter_length );
   dissect_isup_cause_indicators_parameter(parameter_tvb, parameter_tree, parameter_item);
   offset += PARAMETER_POINTER_LENGTH;
@@ -3698,7 +3686,7 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup
    proto_tree_add_uint_format(isup_tree, hf_isup_message_type, message_tvb, 0, MESSAGE_TYPE_LENGTH, message_type, "Message type: %s (%u)", val_to_str(message_type, isup_message_type_value, "reserved"), message_type);
    offset +=  MESSAGE_TYPE_LENGTH;
 
-   bufferlength = tvb_length_remaining(message_tvb, offset);
+   bufferlength = tvb_ensure_length_remaining(message_tvb, offset);
    parameter_tvb = tvb_new_subset(message_tvb, offset, bufferlength, bufferlength);
 
    /* distinguish between message types:*/
@@ -3806,7 +3794,7 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup
       /* call dissect_isup_message recursively */
       {        guint8 pa_message_type;
        pa_message_type = tvb_get_guint8(parameter_tvb, 0);
-       pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, tvb_length_remaining(parameter_tvb, offset), "Pass-along: %s Message (%u)", val_to_str(pa_message_type, isup_message_type_value, "reserved"), pa_message_type);
+       pass_along_item = proto_tree_add_text(isup_tree, parameter_tvb, offset, -1, "Pass-along: %s Message (%u)", val_to_str(pa_message_type, isup_message_type_value, "reserved"), pa_message_type);
        pass_along_tree = proto_item_add_subtree(pass_along_item, ett_isup_pass_along_message);
        dissect_isup_message(parameter_tvb, pinfo, pass_along_tree);
        break;
index a9c38358f4f459fc14820009120f2ed4b285e2d2..ba5a14dfe14bf1bc3872a2907331887e1c28cbfa 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Routines for RFC 2250 MPEG-1 dissection
  *
- * $Id: packet-mpeg1.c,v 1.6 2002/01/24 09:20:49 guy Exp $
+ * $Id: packet-mpeg1.c,v 1.7 2002/02/01 04:34:15 gram Exp $
  * 
  * Copyright 2001, 
  * Francisco Javier Cabello Torres, <fjcabello@vtools.es>
@@ -192,7 +192,7 @@ dissect_mpeg1( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
            offset += 1;
          
            /* The rest of the packet is the MPEG-1 stream */
-           proto_tree_add_item( mpg_tree, hf_rtp_mpg_data, tvb, offset, tvb_length_remaining( tvb, offset ), FALSE );
+           proto_tree_add_item( mpg_tree, hf_rtp_mpg_data, tvb, offset, -1, FALSE );
 
          }
 }
index d0af57b63c886875205a7f52d5b5a803668e0d1b..70e5ef35beb97b99b2660da8a76760971c1dfb09 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-tns.c
  * Routines for Oracle TNS packet dissection
  *
- * $Id: packet-tns.c,v 1.28 2002/01/24 09:20:52 guy Exp $
+ * $Id: packet-tns.c,v 1.29 2002/02/01 04:34:15 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -371,8 +371,7 @@ static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo,
        if ( connect_tree && cd_len > 0)
        {
                proto_tree_add_item(connect_tree, hf_tns_connect_data, tvb,
-                       tns_offset+cd_offset,
-                       tvb_length_remaining(tvb, tns_offset+cd_offset), FALSE);
+                       tns_offset+cd_offset, -1, FALSE);
        }
        return;
 }
@@ -468,8 +467,7 @@ static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo,
        if ( accept_tree && accept_len > 0)
        {
                proto_tree_add_item(accept_tree, hf_tns_accept_data, tvb,
-                       tns_offset+accept_offset,
-                       tvb_length_remaining(tvb, tns_offset+accept_offset), FALSE);
+                       tns_offset+accept_offset, -1, FALSE);
        }
        return;
 }
@@ -519,7 +517,7 @@ static void dissect_tns_refuse(tvbuff_t *tvb, int offset, packet_info *pinfo,
        if ( refuse_tree )
        {
                proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb,
-                       offset, tvb_length_remaining(tvb, offset), FALSE);
+                       offset, -1, FALSE);
        }
        return;
 }
@@ -562,7 +560,7 @@ static void dissect_tns_abort(tvbuff_t *tvb, int offset, packet_info *pinfo,
        if ( abort_tree )
        {
                proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb,
-                       offset, tvb_length_remaining(tvb,offset), FALSE);
+                       offset, -1, FALSE);
        }
        return;
 }
@@ -657,7 +655,7 @@ static void dissect_tns_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
        if ( redirect_tree )
        {
                proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb,
-                       offset, tvb_length_remaining(tvb, offset), FALSE);
+                       offset, -1, FALSE);
        }
        return;
 }
@@ -692,7 +690,7 @@ static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo,
        if ( control_tree )
        {
                proto_tree_add_item(control_tree, hf_tns_control_data, tvb,
-                       offset, tvb_length_remaining(tvb, offset), FALSE);
+                       offset, -1, FALSE);
        }
        return;
 }