aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tns.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2002-02-01 04:34:17 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2002-02-01 04:34:17 +0000
commitbd4a9c13eb557b93f3e80f2c66226cbfe6082a82 (patch)
tree65878dfe4ebb3e9f077e408a572bc9227a524ded /packet-tns.c
parenta9f7ef50586b671e402cf24f7175d07e18e0f180 (diff)
Provide tvb_ensure_length_remaining(), which is like
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. svn path=/trunk/; revision=4656
Diffstat (limited to 'packet-tns.c')
-rw-r--r--packet-tns.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/packet-tns.c b/packet-tns.c
index d0af57b63c..70e5ef35be 100644
--- a/packet-tns.c
+++ b/packet-tns.c
@@ -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;
}