aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2015-06-23 17:22:18 -0700
committerEvan Huus <eapache@gmail.com>2015-06-24 00:22:50 +0000
commitf92fab41a5266cb380c443882ce5efd5a7ee3318 (patch)
tree13e190875507342a2c5847b2629a6dab44d2d61d /epan
parentad784bc7ce29c2d8ad64bca73e4863a6353c578f (diff)
Remove a bunch more deprecated tvb_length calls
(getting really close!) Change-Id: Ibf22a5f727c4dc0070b78144a4b0ab8e0c5e1bce Reviewed-on: https://code.wireshark.org/review/9081 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-h1.c2
-rw-r--r--epan/dissectors/packet-iwarp-mpa.c6
-rw-r--r--epan/dissectors/packet-jxta.c10
-rw-r--r--epan/dissectors/packet-kingfisher.c2
-rw-r--r--epan/dissectors/packet-kink.c10
-rw-r--r--epan/dissectors/packet-knet.c2
-rw-r--r--epan/dissectors/packet-knxnetip.c2
-rw-r--r--epan/dissectors/packet-lanforge.c2
-rw-r--r--epan/dissectors/packet-lapsat.c8
-rw-r--r--epan/dissectors/packet-ldp.c4
-rw-r--r--epan/dissectors/packet-ldss.c18
-rw-r--r--epan/dissectors/packet-lltd.c4
-rw-r--r--epan/dissectors/packet-lmp.c2
-rw-r--r--epan/dissectors/packet-loop.c2
-rw-r--r--epan/dissectors/packet-lsc.c6
-rw-r--r--epan/dissectors/packet-ltp.c46
-rw-r--r--epan/dissectors/packet-macsec.c4
-rw-r--r--epan/dissectors/packet-mactelnet.c2
-rw-r--r--epan/dissectors/packet-mbtcp.c8
-rw-r--r--epan/dissectors/packet-mdshdr.c6
-rw-r--r--epan/dissectors/packet-memcache.c8
-rw-r--r--epan/dissectors/packet-mim.c2
-rw-r--r--epan/dissectors/packet-mint.c14
-rw-r--r--epan/dissectors/packet-miop.c2
-rw-r--r--epan/dissectors/packet-mndp.c4
-rw-r--r--epan/dissectors/packet-mojito.c2
-rw-r--r--epan/dissectors/packet-moldudp64.c2
-rw-r--r--epan/dissectors/packet-mpls-echo.c2
-rw-r--r--epan/dissectors/packet-mrcpv2.c4
-rw-r--r--epan/dissectors/packet-msdp.c4
-rw-r--r--epan/dissectors/packet-msrp.c2
-rw-r--r--epan/dissectors/packet-mstp.c2
-rw-r--r--epan/dissectors/packet-mtp3mg.c2
-rw-r--r--epan/dissectors/packet-nbd.c6
-rw-r--r--epan/dissectors/packet-nbt.c6
-rw-r--r--epan/dissectors/packet-ncp-sss.c30
-rw-r--r--epan/dissectors/packet-ncp.c8
-rw-r--r--epan/dissectors/packet-negoex.c4
-rw-r--r--epan/dissectors/packet-netanalyzer.c8
39 files changed, 126 insertions, 132 deletions
diff --git a/epan/dissectors/packet-h1.c b/epan/dissectors/packet-h1.c
index 2c2cb3de59..5b6b5df896 100644
--- a/epan/dissectors/packet-h1.c
+++ b/epan/dissectors/packet-h1.c
@@ -107,7 +107,7 @@ static gboolean dissect_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
unsigned int position = 3;
unsigned int offset=0;
- if (tvb_length(tvb) < 2)
+ if (tvb_captured_length(tvb) < 2)
{
/* Not enough data captured to hold the "S5" header; don't try
to interpret it as H1. */
diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c
index e07cf9ec1f..16b6998d83 100644
--- a/epan/dissectors/packet-iwarp-mpa.c
+++ b/epan/dissectors/packet-iwarp-mpa.c
@@ -307,7 +307,7 @@ remove_markers(tvbuff_t *tvb, packet_info *pinfo, guint32 marker_offset,
DISSECTOR_ASSERT(num_markers > 0);
DISSECTOR_ASSERT(orig_length > MPA_MARKER_LEN * num_markers);
- DISSECTOR_ASSERT(tvb_length(tvb) == orig_length);
+ DISSECTOR_ASSERT(tvb_captured_length(tvb) == orig_length);
/* allocate memory for the marker-free buffer */
mfree_buff_length = orig_length - (MPA_MARKER_LEN * num_markers);
@@ -793,7 +793,7 @@ dissect_iwarp_mpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
tcpinfo = (struct tcpinfo *)data;
/* FPDU */
- if (tvb_length(tvb) >= MPA_SMALLEST_FPDU_LEN && is_mpa_fpdu(pinfo)) {
+ if (tvb_captured_length(tvb) >= MPA_SMALLEST_FPDU_LEN && is_mpa_fpdu(pinfo)) {
conversation = find_conversation(pinfo->fd->num, &pinfo->src,
&pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
@@ -850,7 +850,7 @@ dissect_iwarp_mpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
/* MPA REQUEST or MPA REPLY */
- if (tvb_length(tvb) >= MPA_REQ_REP_FRAME_HEADER_LEN) {
+ if (tvb_captured_length(tvb) >= MPA_REQ_REP_FRAME_HEADER_LEN) {
if (is_mpa_req(tvb, pinfo))
return dissect_mpa_req_rep(tvb, pinfo, tree, MPA_REQUEST_FRAME);
else if (is_mpa_rep(tvb, pinfo))
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index af0b9c1831..4ee41b9336 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -2088,7 +2088,7 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf
dissected = call_dissector(ssl_handle, tvb, pinfo, tree);
}
} else if (0 == strcmp("application/gzip", mediatype)) {
- tvbuff_t *uncomp_tvb = tvb_child_uncompress(tvb, tvb, 0, tvb_length(tvb));
+ tvbuff_t *uncomp_tvb = tvb_child_uncompress(tvb, tvb, 0, tvb_captured_length(tvb));
if( NULL != uncomp_tvb ) {
add_new_data_source(pinfo, uncomp_tvb, "Uncompressed Element Content");
@@ -2098,14 +2098,14 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf
if( dissected > 0 ) {
/* report back the uncompressed length. */
- dissected = tvb_length(tvb);
+ dissected = tvb_captured_length(tvb);
}
}
} else {
- dissected = dissector_try_string(media_type_dissector_table, mediatype, tvb, pinfo, tree, media_str) ? tvb_length(tvb) : 0;
+ dissected = dissector_try_string(media_type_dissector_table, mediatype, tvb, pinfo, tree, media_str) ? tvb_captured_length(tvb) : 0;
- if( dissected != (int) tvb_length(tvb) ) {
- /* g_message( "%s : %d expected, %d dissected", mediatype, tvb_length(tvb), dissected ); */
+ if( dissected != (int) tvb_captured_length(tvb) ) {
+ /* g_message( "%s : %d expected, %d dissected", mediatype, tvb_captured_length(tvb), dissected ); */
}
}
diff --git a/epan/dissectors/packet-kingfisher.c b/epan/dissectors/packet-kingfisher.c
index 83139f8400..30d6e5d85a 100644
--- a/epan/dissectors/packet-kingfisher.c
+++ b/epan/dissectors/packet-kingfisher.c
@@ -232,7 +232,7 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
/* verify the length */
kfp.length = tvb_get_guint8(tvb, 2);
- if((kfp.length+1) != (guint8)tvb_length(tvb)){
+ if((kfp.length+1) != (guint8)tvb_captured_length(tvb)){
return FALSE;
}
diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c
index 39c37bf91b..8b6f8a89b9 100644
--- a/epan/dissectors/packet-kink.c
+++ b/epan/dissectors/packet-kink.c
@@ -355,7 +355,7 @@ dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
tvbuff_t *krb_tvb;
krb_ap_req_length = payload_length - PAYLOAD_HEADER;
- krb_tvb=tvb_new_subset(tvb, offset, (krb_ap_req_length>tvb_length_remaining(tvb, offset))?tvb_length_remaining(tvb, offset):krb_ap_req_length, krb_ap_req_length);
+ krb_tvb=tvb_new_subset(tvb, offset, (krb_ap_req_length>tvb_captured_length_remaining(tvb, offset))?tvb_captured_length_remaining(tvb, offset):krb_ap_req_length, krb_ap_req_length);
keytype=kerberos_output_keytype();
dissect_kerberos_main(krb_tvb, pinfo, payload_kink_ap_req_tree, FALSE, NULL);
/*offset += krb_ap_req_length;*/
@@ -410,7 +410,7 @@ dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
tvbuff_t *krb_tvb;
krb_ap_rep_length = payload_length - PAYLOAD_HEADER;
- krb_tvb=tvb_new_subset(tvb, offset, (krb_ap_rep_length>tvb_length_remaining(tvb, offset))?tvb_length_remaining(tvb, offset):krb_ap_rep_length, krb_ap_rep_length);
+ krb_tvb=tvb_new_subset(tvb, offset, (krb_ap_rep_length>tvb_captured_length_remaining(tvb, offset))?tvb_captured_length_remaining(tvb, offset):krb_ap_rep_length, krb_ap_rep_length);
keytype=kerberos_output_keytype();
dissect_kerberos_main(krb_tvb, pinfo, payload_kink_ap_rep_tree, FALSE, NULL);
@@ -463,7 +463,7 @@ dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, pr
tvbuff_t *krb_tvb;
krb_error_length = payload_length - KINK_KRB_ERROR_HEADER;
- krb_tvb=tvb_new_subset(tvb, offset, (krb_error_length>tvb_length_remaining(tvb, offset))?tvb_length_remaining(tvb, offset):krb_error_length, krb_error_length);
+ krb_tvb=tvb_new_subset(tvb, offset, (krb_error_length>tvb_captured_length_remaining(tvb, offset))?tvb_captured_length_remaining(tvb, offset):krb_error_length, krb_error_length);
dissect_kerberos_main(krb_tvb, pinfo, payload_kink_krb_error_tree, FALSE, NULL);
/*offset += krb_error_length;*/
@@ -623,7 +623,7 @@ dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
if(payload_length > PAYLOAD_HEADER){
isakmp_length = payload_length - PAYLOAD_HEADER;
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_captured_length_remaining(tvb, offset);
if (length > (int)isakmp_length)
length = isakmp_length;
reported_length = tvb_reported_length_remaining(tvb, offset);
@@ -687,7 +687,7 @@ dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
tvbuff_t *next_tvb;
guint8 *plaintext=NULL;
- next_tvb=tvb_new_subset(tvb, offset, MIN(tvb_length_remaining(tvb, offset), encrypt_length), encrypt_length);
+ next_tvb=tvb_new_subset(tvb, offset, MIN(tvb_captured_length_remaining(tvb, offset), encrypt_length), encrypt_length);
plaintext=decrypt_krb5_data(tree, pinfo, 0, next_tvb, keytype, NULL);
if(plaintext){
next_tvb=tvb_new_child_real_data(tvb, plaintext, encrypt_length, encrypt_length);
diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c
index 677f0873c5..948c4d3fc1 100644
--- a/epan/dissectors/packet-knet.c
+++ b/epan/dissectors/packet-knet.c
@@ -644,7 +644,7 @@ dissect_knet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(tvb_get_guint8(tvb, 0) & UDP_DATAGRAM_RELIABLE_FLAG)
offset += dissect_reliable_message_index_base(tvb, 3, datagram_tree); /* Calculate RMIB */
- while ((tvb_length_remaining(tvb, offset) > 2) && /* If there's at least 2 bytes available in the buffer */
+ while ((tvb_reported_length_remaining(tvb, offset) > 2) && /* If there's at least 2 bytes available in the buffer */
(dissect_content_length(tvb, offset, NULL) > 0)) /* Empty data Abort */
{
offset += dissect_knet_message(tvb, pinfo, knet_tree, offset, messageindex); /* Call the message subdissector */
diff --git a/epan/dissectors/packet-knxnetip.c b/epan/dissectors/packet-knxnetip.c
index 77c78821ac..038f5b822d 100644
--- a/epan/dissectors/packet-knxnetip.c
+++ b/epan/dissectors/packet-knxnetip.c
@@ -1524,7 +1524,7 @@ static gboolean dissect_knxnetip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_t
gint idx;
idx = 0;
- if (tvb_length(tvb) < 8){
+ if (tvb_captured_length(tvb) < 8){
return (FALSE);
}
if ( tvb_get_guint8(tvb, 0) != KNXNETIP_HEADER_LENGTH) {
diff --git a/epan/dissectors/packet-lanforge.c b/epan/dissectors/packet-lanforge.c
index 56f405a05e..bd02f8ecf3 100644
--- a/epan/dissectors/packet-lanforge.c
+++ b/epan/dissectors/packet-lanforge.c
@@ -75,7 +75,7 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
guint32 pld_len, magic;
/* check for min size */
- if(tvb_length(tvb) < 28) { /* Not a LANforge packet. */
+ if(tvb_captured_length(tvb) < 28) { /* Not a LANforge packet. */
return FALSE;
}
diff --git a/epan/dissectors/packet-lapsat.c b/epan/dissectors/packet-lapsat.c
index 3b0f16b046..5939a0f1fa 100644
--- a/epan/dissectors/packet-lapsat.c
+++ b/epan/dissectors/packet-lapsat.c
@@ -438,7 +438,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
unsigned int hlen, is_response = 0, plen;
/* Check that there's enough data */
- if (tvb_length(tvb) < LAPSAT_HEADER_LEN)
+ if (tvb_captured_length(tvb) < LAPSAT_HEADER_LEN)
return;
/* Set protocol column */
@@ -494,14 +494,14 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Get the payload */
plen = (addr & LAPSAT_LFI) ?
- tvb_get_guint8(tvb, 3) : tvb_length(tvb) - hlen;
+ tvb_get_guint8(tvb, 3) : tvb_captured_length(tvb) - hlen;
if (!plen)
return; /* No point in doing more if there is no payload */
- DISSECTOR_ASSERT((plen + hlen) <= tvb_length(tvb));
+ DISSECTOR_ASSERT((plen + hlen) <= tvb_captured_length(tvb));
- if ((plen + hlen) == tvb_length(tvb)) {
+ if ((plen + hlen) == tvb_captured_length(tvb)) {
/* Need to integrate the last nibble */
guint8 *data = (guint8 *)tvb_memdup(NULL, tvb, hlen, plen);
data[plen-1] |= tvb_get_guint8(tvb, 2) << 4;
diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c
index 6355b1da80..46ac08a862 100644
--- a/epan/dissectors/packet-ldp.c
+++ b/epan/dissectors/packet-ldp.c
@@ -2867,7 +2867,7 @@ dissect_ldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
* packets that happen to be going to or from the
* LDP port but that aren't LDP packets.
*/
- if (tvb_length(tvb) < 2) {
+ if (tvb_captured_length(tvb) < 2) {
/*
* Not enough information to tell.
*/
@@ -3095,7 +3095,7 @@ dissect_ldp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
int length;
tvbuff_t *volatile next_tvb;
while (tvb_reported_length_remaining(tvb, offset) != 0) {
- length_remaining = tvb_length_remaining(tvb, offset);
+ length_remaining = tvb_captured_length_remaining(tvb, offset);
/*
* Make sure the first PDU has a version number of 1;
diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c
index 3188d4fb51..bf50cb8f51 100644
--- a/epan/dissectors/packet-ldss.c
+++ b/epan/dissectors/packet-ldss.c
@@ -329,7 +329,7 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* instead of just filling out the columns), then give more detail. */
if (tree) {
ti = proto_tree_add_item(tree, proto_ldss,
- tvb, 0, (tvb_length(tvb) > 72) ? tvb_length(tvb) : 72, ENC_NA);
+ tvb, 0, (tvb_captured_length(tvb) > 72) ? tvb_captured_length(tvb) : 72, ENC_NA);
ldss_tree = proto_item_add_subtree(ti, ett_ldss_broadcast);
proto_tree_add_item(ldss_tree, hf_ldss_message_id,
@@ -383,9 +383,9 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, 68, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(ldss_tree, hf_ldss_property_count,
tvb, 70, 2, ENC_BIG_ENDIAN);
- if (tvb_length(tvb) > 72) {
+ if (tvb_reported_length(tvb) > 72) {
proto_tree_add_item(ldss_tree, hf_ldss_properties,
- tvb, 72, tvb_length(tvb) - 72, ENC_NA);
+ tvb, 72, tvb_captured_length(tvb) - 72, ENC_NA);
}
}
@@ -661,7 +661,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
* Always desegment if the size is 0 (ie. unknown)
*/
if (pinfo->can_desegment) {
- if (size == 0 || tvb_length(tvb) < size) {
+ if (size == 0 || tvb_captured_length(tvb) < size) {
pinfo->desegment_offset = 0;
pinfo->desegment_len = DESEGMENT_UNTIL_FIN;
return 0;
@@ -682,16 +682,16 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
tvb, 0, tvb_reported_length(tvb), ENC_NA);
ldss_tree = proto_item_add_subtree(ti, ett_ldss_transfer);
proto_tree_add_bytes_format(ldss_tree, hf_ldss_file_data,
- tvb, 0, tvb_length(tvb), NULL,
+ tvb, 0, tvb_captured_length(tvb), NULL,
compression == COMPRESSION_GZIP
? "Gzip compressed data: %d bytes"
: "File data: %d bytes",
- tvb_length(tvb));
+ tvb_captured_length(tvb));
#ifdef HAVE_LIBZ
/* Be nice and uncompress the file data. */
if (compression == COMPRESSION_GZIP) {
tvbuff_t *uncomp_tvb;
- uncomp_tvb = tvb_child_uncompress(tvb, tvb, 0, tvb_length(tvb));
+ uncomp_tvb = tvb_child_uncompress(tvb, tvb, 0, tvb_captured_length(tvb));
if (uncomp_tvb != NULL) {
/* XXX: Maybe not a good idea to add a data_source for
what may very well be a large buffer since then
@@ -702,9 +702,9 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
*/
add_new_data_source(pinfo, uncomp_tvb, "Uncompressed Data");
proto_tree_add_bytes_format_value(ldss_tree, hf_ldss_file_data,
- uncomp_tvb, 0, tvb_length(uncomp_tvb),
+ uncomp_tvb, 0, tvb_captured_length(uncomp_tvb),
NULL, "Uncompressed data: %d bytes",
- tvb_length(uncomp_tvb));
+ tvb_captured_length(uncomp_tvb));
}
}
#endif
diff --git a/epan/dissectors/packet-lltd.c b/epan/dissectors/packet-lltd.c
index be26950cd8..6d8c4181fe 100644
--- a/epan/dissectors/packet-lltd.c
+++ b/epan/dissectors/packet-lltd.c
@@ -347,7 +347,7 @@ dissect_lltd_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 of
proto_tree_add_item(tlv_tree, hf_lltd_tlv_length, tvb, offset+1, 1, ENC_NA);
- if ((type != 0) && (length > tvb_length_remaining(tvb, offset+2)))
+ if ((type != 0) && (length > tvb_reported_length_remaining(tvb, offset+2)))
{
expert_add_info_format(pinfo, tlv_item, &ei_lltd_tlv_length_invalid, "TLV Length field too big");
*end = TRUE;
@@ -599,7 +599,7 @@ dissect_lltd_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
func_tree = proto_tree_add_subtree(tree, tvb, offset+28, 0, ett_tlv, &func_item, "TLVs");
start_offset = loop_offset = offset+28;
- while ((end_tlv == FALSE) && (tvb_length_remaining(tvb, loop_offset) >= 1))
+ while ((end_tlv == FALSE) && (tvb_reported_length_remaining(tvb, loop_offset) >= 1))
{
loop_offset += dissect_lltd_tlv(tvb, pinfo, func_tree, loop_offset, &end_tlv);
}
diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c
index 522605d07e..bca7b331c9 100644
--- a/epan/dissectors/packet-lmp.c
+++ b/epan/dissectors/packet-lmp.c
@@ -765,7 +765,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
cksum = tvb_get_ntohs(tvb, offset+6);
ti = proto_tree_add_item(lmp_header_tree, hf_lmp_filter[LMPF_CHECKSUM], tvb,
offset+6, 2, ENC_BIG_ENDIAN);
- if (!pinfo->fragmented && (int) tvb_length(tvb) >= msg_length) {
+ if (!pinfo->fragmented && (int) tvb_captured_length(tvb) >= msg_length) {
/* The packet isn't part of a fragmented datagram and isn't truncated, so we can checksum it. */
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, msg_length);
computed_cksum = in_cksum(cksum_vec, 1);
diff --git a/epan/dissectors/packet-loop.c b/epan/dissectors/packet-loop.c
index 6347837ec2..e19c9f90f8 100644
--- a/epan/dissectors/packet-loop.c
+++ b/epan/dissectors/packet-loop.c
@@ -113,7 +113,7 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_INFO, "No valid function found");
}
- if (tvb_length_remaining(tvb, offset) > 0)
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
{
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle, next_tvb, pinfo, tree);
diff --git a/epan/dissectors/packet-lsc.c b/epan/dissectors/packet-lsc.c
index 979af7f82b..c1260ffddb 100644
--- a/epan/dissectors/packet-lsc.c
+++ b/epan/dissectors/packet-lsc.c
@@ -144,7 +144,7 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
col_clear(pinfo->cinfo, COL_INFO);
/* Too little data? */
- if (tvb_length(tvb) < LSC_MIN_LEN)
+ if (tvb_captured_length(tvb) < LSC_MIN_LEN)
{
col_set_str(pinfo->cinfo, COL_INFO, "[Too short]");
return 0;
@@ -196,9 +196,9 @@ dissect_lsc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
val_to_str(op_code, op_code_vals, "Unknown op code (0x%x)"),
stream);
- if (tvb_length(tvb) < expected_len)
+ if (tvb_reported_length(tvb) < expected_len)
col_append_str(pinfo->cinfo, COL_INFO, " [Too short]");
- else if (tvb_length(tvb) > expected_len)
+ else if (tvb_reported_length(tvb) > expected_len)
col_append_str(pinfo->cinfo, COL_INFO, " [Too long]");
if (tree) {
diff --git a/epan/dissectors/packet-ltp.c b/epan/dissectors/packet-ltp.c
index 71a54d31db..6cc142da91 100644
--- a/epan/dissectors/packet-ltp.c
+++ b/epan/dissectors/packet-ltp.c
@@ -239,14 +239,14 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
client_id = evaluate_sdnv_64(tvb,frame_offset + segment_offset,&client_id_size);
segment_offset+= client_id_size;
- if((unsigned)(frame_offset + segment_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) >= tvb_captured_length(tvb)){
/* This would mean the data segment is incomplete */
return 0;
}
offset = evaluate_sdnv_64(tvb,frame_offset + segment_offset,&offset_size);
segment_offset+= offset_size;
- if((unsigned)(frame_offset + segment_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) >= tvb_captured_length(tvb)){
/* This would mean the data segment is incomplete */
return 0;
}
@@ -254,7 +254,7 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
length = evaluate_sdnv_64(tvb,frame_offset + segment_offset,&length_size);
segment_offset+= length_size;
- if((unsigned)(frame_offset + segment_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) >= tvb_captured_length(tvb)){
/* This would mean the data segment is incomplete */
return 0;
}
@@ -264,7 +264,7 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
chkp_sno = evaluate_sdnv_64(tvb,frame_offset + segment_offset,&chkp_sno_size);
segment_offset+= chkp_sno_size;
- if((unsigned)(frame_offset + segment_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) >= tvb_captured_length(tvb)){
/* This would mean the data segment is incomplete */
return 0;
}
@@ -272,7 +272,7 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
rpt_sno = evaluate_sdnv_64(tvb,frame_offset + segment_offset,&rpt_sno_size);
segment_offset+= rpt_sno_size;
- if((unsigned)(frame_offset + segment_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) >= tvb_captured_length(tvb)){
/* This would mean the data segment is incomplete */
return 0;
}
@@ -288,7 +288,7 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
/* Addition result has wrapped */
return 0;
}
- if((unsigned)(frame_offset + segment_offset) > tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) > tvb_captured_length(tvb)){
/* This would mean the data segment is incomplete */
return 0;
}
@@ -349,13 +349,13 @@ dissect_data_segment(proto_tree *ltp_tree, tvbuff_t *tvb,packet_info *pinfo,int
if(new_tvb)
{
- data_length = tvb_length(new_tvb);
+ data_length = tvb_captured_length(new_tvb);
while(dissected_data_size < data_length)
{
ltp_data_data_tree = proto_tree_add_subtree_format(ltp_data_tree, tvb,frame_offset, 0,
ett_data_data_segm, NULL, "Data[%d]",data_count);
- datatvb = tvb_new_subset(new_tvb, data_offset, (int)data_length - dissected_data_size, tvb_length(new_tvb));
+ datatvb = tvb_new_subset(new_tvb, data_offset, (int)data_length - dissected_data_size, tvb_captured_length(new_tvb));
bundle_size = call_dissector(bundle_handle, datatvb, pinfo, ltp_data_data_tree);
if(bundle_size == 0) { /*Couldn't parse bundle*/
col_set_str(pinfo->cinfo, COL_INFO, "Dissection Failed");
@@ -441,11 +441,11 @@ dissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree,
* max number of claims we can possibly squeeze into the remaining tvbuff, then
* the packet is malformed.
*/
- if (rcpt_clm_cnt > tvb_length_remaining(tvb, frame_offset + segment_offset) / 2) {
+ if (rcpt_clm_cnt > tvb_reported_length_remaining(tvb, frame_offset + segment_offset) / 2) {
proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset);
expert_add_info_format(pinfo, ltp_tree, &ei_ltp_mal_reception_claim,
"Reception claim count impossibly large: %d > %d", rcpt_clm_cnt,
- tvb_length_remaining(tvb, frame_offset + segment_offset) / 2);
+ tvb_reported_length_remaining(tvb, frame_offset + segment_offset) / 2);
return 0;
}
proto_tree_add_uint(ltp_rpt_tree, hf_ltp_rpt_clm_cnt, tvb, frame_offset + segment_offset, rcpt_clm_cnt_size, rcpt_clm_cnt);
@@ -484,7 +484,7 @@ dissect_report_ack_segment(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset)
rpt_sno = evaluate_sdnv_64(tvb,frame_offset, &rpt_sno_size);
segment_offset += rpt_sno_size;
- if((unsigned)(frame_offset + segment_offset) > tvb_length(tvb)){
+ if((unsigned)(frame_offset + segment_offset) > tvb_captured_length(tvb)){
return 0;
}
@@ -533,17 +533,17 @@ dissect_header_extn(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset,int hdr
extn_type[i] = tvb_get_guint8(tvb,frame_offset);
extn_offset++;
- if((unsigned)(frame_offset + extn_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + extn_offset) >= tvb_captured_length(tvb)){
return 0;
}
length[i] = evaluate_sdnv_64(tvb,frame_offset,&length_size[i]);
extn_offset += length_size[i];
- if((unsigned)(frame_offset + extn_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + extn_offset) >= tvb_captured_length(tvb)){
return 0;
}
value[i] = evaluate_sdnv_64(tvb,frame_offset,&value_size[i]);
extn_offset += value_size[i];
- if((unsigned)(frame_offset + extn_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + extn_offset) >= tvb_captured_length(tvb)){
return 0;
}
}
@@ -581,21 +581,21 @@ dissect_trailer_extn(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset,int tr
extn_type[i] = tvb_get_guint8(tvb,frame_offset);
extn_offset++;
- if((unsigned)(frame_offset + extn_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + extn_offset) >= tvb_captured_length(tvb)){
return 0;
}
length[i] = evaluate_sdnv_64(tvb,frame_offset,&length_size[i]);
extn_offset += length_size[i];
- if((unsigned)(frame_offset + extn_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + extn_offset) >= tvb_captured_length(tvb)){
return 0;
}
value[i] = evaluate_sdnv_64(tvb,frame_offset,&value_size[i]);
extn_offset += value_size[i];
- if((unsigned)(frame_offset + extn_offset) >= tvb_length(tvb)){
+ if((unsigned)(frame_offset + extn_offset) >= tvb_captured_length(tvb)){
return 0;
}
}
@@ -643,7 +643,7 @@ dissect_ltp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
proto_tree *ltp_session_tree = NULL;
/* Check that there's enough data */
- if(tvb_length(tvb) < LTP_MIN_DATA_BUFFER){
+ if(tvb_captured_length(tvb) < LTP_MIN_DATA_BUFFER){
return 0;
}
frame_offset = 0;
@@ -657,14 +657,14 @@ dissect_ltp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
engine_id = evaluate_sdnv_64(tvb,frame_offset + header_offset,&engine_id_size);
header_offset += engine_id_size;
- if((unsigned)header_offset >= tvb_length(tvb)){
+ if((unsigned)header_offset >= tvb_captured_length(tvb)){
col_set_str(pinfo->cinfo, COL_INFO, "Protocol Error");
return 0;
}
session_num = evaluate_sdnv_64(tvb,frame_offset + header_offset,&session_num_size);
header_offset += session_num_size;
- if((unsigned)header_offset >= tvb_length(tvb)){
+ if((unsigned)header_offset >= tvb_captured_length(tvb)){
col_set_str(pinfo->cinfo, COL_INFO, "Protocol Error");
return 0;
}
@@ -700,7 +700,7 @@ dissect_ltp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(ltp_type,ltp_type_col_info,"Protocol Error"));
- if((unsigned)frame_offset >= tvb_length(tvb)){
+ if((unsigned)frame_offset >= tvb_captured_length(tvb)){
col_set_str(pinfo->cinfo, COL_INFO, "Protocol Error");
return 0;
}
@@ -715,7 +715,7 @@ dissect_ltp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
frame_offset += hdr_extn_offset;
}
- if((unsigned)frame_offset >= tvb_length(tvb)){
+ if((unsigned)frame_offset >= tvb_captured_length(tvb)){
col_set_str(pinfo->cinfo, COL_INFO, "Protocol Error");
return 0;
}
@@ -752,7 +752,7 @@ dissect_ltp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
frame_offset += segment_offset;
/* Check to see if there are any trailer extensions */
if(trl_extn_cnt > 0){
- if((unsigned)frame_offset >= tvb_length(tvb)){
+ if((unsigned)frame_offset >= tvb_captured_length(tvb)){
col_set_str(pinfo->cinfo, COL_INFO, "Protocol Error");
return 0;
}
diff --git a/epan/dissectors/packet-macsec.c b/epan/dissectors/packet-macsec.c
index a2986826b5..f70ae6d590 100644
--- a/epan/dissectors/packet-macsec.c
+++ b/epan/dissectors/packet-macsec.c
@@ -83,12 +83,12 @@ static int dissect_macsec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
}
/* Check for short length */
- if (tvb_length(tvb) <= (sectag_length + icv_length)) {
+ if (tvb_captured_length(tvb) <= (sectag_length + icv_length)) {
return 0;
}
data_offset = sectag_length;
- data_length = tvb_length(tvb) - sectag_length - icv_length;
+ data_length = tvb_captured_length(tvb) - sectag_length - icv_length;
icv_offset = data_length + data_offset;
next_tvb = tvb_new_subset_length(tvb, data_offset, data_length);
diff --git a/epan/dissectors/packet-mactelnet.c b/epan/dissectors/packet-mactelnet.c
index 019a4d2b90..3b34e9def1 100644
--- a/epan/dissectors/packet-mactelnet.c
+++ b/epan/dissectors/packet-mactelnet.c
@@ -114,7 +114,7 @@ dissect_mactelnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
guint16 type;
/* Check that there's enough data */
- if (tvb_length(tvb) < 18)
+ if (tvb_captured_length(tvb) < 18)
return 0;
/* Get the type byte */
diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c
index 6bd436e5e2..fb9f47029a 100644
--- a/epan/dissectors/packet-mbtcp.c
+++ b/epan/dissectors/packet-mbtcp.c
@@ -528,7 +528,7 @@ dissect_mbtcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
p_add_proto_data(wmem_file_scope(), pinfo, proto_modbus, 0, request_info);
/* Continue with dissection of Modbus data payload following Modbus/TCP frame */
- if( tvb_length_remaining(tvb, offset) > 0 )
+ if( tvb_reported_length_remaining(tvb, offset) > 0 )
call_dissector(modbus_handle, next_tvb, pinfo, tree);
p_remove_proto_data(wmem_file_scope(), pinfo, proto_modbus, 0);
@@ -557,7 +557,7 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Modbus RTU");
col_clear(pinfo->cinfo, COL_INFO);
- len = tvb_length(tvb);
+ len = tvb_reported_length(tvb);
unit_id = tvb_get_guint8(tvb, 0);
function_code = tvb_get_guint8(tvb, 1) & 0x7F;
@@ -670,7 +670,7 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
p_add_proto_data(wmem_file_scope(), pinfo, proto_modbus, 0, request_info);
/* Continue with dissection of Modbus data payload following Modbus RTU frame */
- if( tvb_length_remaining(tvb, offset) > 0 )
+ if( tvb_reported_length_remaining(tvb, offset) > 0 )
call_dissector(modbus_handle, next_tvb, pinfo, tree);
p_remove_proto_data(wmem_file_scope(), pinfo, proto_modbus, 0);
@@ -887,7 +887,7 @@ dissect_modbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
guint16 diagnostic_code;
modbus_request_info_t *request_info;
- len = tvb_length_remaining(tvb, 0);
+ len = tvb_captured_length(tvb);
/* If the packet is zero-length, we should not attempt to dissect any further */
if (len == 0)
diff --git a/epan/dissectors/packet-mdshdr.c b/epan/dissectors/packet-mdshdr.c
index eb1ae656a0..34a427296d 100644
--- a/epan/dissectors/packet-mdshdr.c
+++ b/epan/dissectors/packet-mdshdr.c
@@ -152,7 +152,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pktlen = tvb_get_ntohs(tvb, offset+MDSHDR_PKTLEN_OFFSET) & 0x1FFF;
/* The Mdshdr trailer is at the end of the frame */
- if ((tvb_length(tvb) >= (MDSHDR_HEADER_SIZE + pktlen))
+ if ((tvb_captured_length(tvb) >= (MDSHDR_HEADER_SIZE + pktlen))
/* Avoid header/trailer overlap if something wrong */
&& (pktlen >= MDSHDR_TRAILER_SIZE)) {
trailer_start = MDSHDR_HEADER_SIZE + pktlen - MDSHDR_TRAILER_SIZE;
@@ -211,7 +211,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
PROTO_ITEM_SET_HIDDEN(hidden_item);
/* Add Mdshdr Trailer part */
- if (tvb_length(tvb) >= MDSHDR_HEADER_SIZE + pktlen
+ if (tvb_reported_length(tvb) >= MDSHDR_HEADER_SIZE + pktlen
&& 0 != trailer_start) {
mdshdr_tree_trlr = proto_tree_add_subtree(mdshdr_tree_main, tvb, trailer_start,
MDSHDR_TRAILER_SIZE,
@@ -227,7 +227,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- if (tvb_length(tvb) >= MDSHDR_HEADER_SIZE + pktlen
+ if (tvb_reported_length(tvb) >= MDSHDR_HEADER_SIZE + pktlen
&& 0 != pktlen /*if something wrong*/) {
next_tvb = tvb_new_subset_length(tvb, MDSHDR_HEADER_SIZE, pktlen);
/* XXX what to do with the rest of this frame? --ArtemTamazov */
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c
index 7d30d14d53..f28964af8b 100644
--- a/epan/dissectors/packet-memcache.c
+++ b/epan/dissectors/packet-memcache.c
@@ -672,7 +672,7 @@ desegment_pdus (tvbuff_t *tvb, packet_info *pinfo, const int offset,
/* data_offset has been set to start of the data block. */
if (!tvb_bytes_exist (tvb, data_offset, content_length)) {
- length_remaining = tvb_length_remaining (tvb, data_offset);
+ length_remaining = tvb_captured_length_remaining (tvb, data_offset);
reported_length_remaining = tvb_reported_length_remaining (tvb, data_offset);
if (length_remaining < reported_length_remaining) {
@@ -734,7 +734,7 @@ memcache_req_resp_hdrs_do_reassembly (
return FALSE;
}
- length_remaining = tvb_length_remaining (tvb, next_offset);
+ length_remaining = tvb_captured_length_remaining (tvb, next_offset);
/* Request one more byte if we cannot find a
* header (i.e. a line end).
@@ -897,7 +897,7 @@ dissect_memcache_message (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_t
* value and the amount of data remaining in the frame.
*
*/
- datalen = tvb_length_remaining (tvb, offset);
+ datalen = tvb_captured_length_remaining (tvb, offset);
if (datalen > 0) {
/*
* We've processed "datalen" bytes worth of data
@@ -927,7 +927,7 @@ content_data_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
*/
if (tvb_reported_length_remaining (tvb, offset) != 0) {
/* bytes actually remaining in this tvbuff. */
- datalen = tvb_length_remaining (tvb, offset);
+ datalen = tvb_captured_length_remaining (tvb, offset);
if (content_length >= 0) {
if (datalen >= (content_length + 2)) { /* also consider \r\n*/
datalen = content_length;
diff --git a/epan/dissectors/packet-mim.c b/epan/dissectors/packet-mim.c
index a9a4c2c206..474fd1af39 100644
--- a/epan/dissectors/packet-mim.c
+++ b/epan/dissectors/packet-mim.c
@@ -285,7 +285,7 @@ dissect_fp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
next_tvb = tvb_new_subset_remaining( tvb, FP_HEADER_SIZE) ;
call_dissector( eth_dissector, next_tvb, pinfo, tree ) ;
- return tvb_length( tvb ) ;
+ return tvb_captured_length( tvb ) ;
}
/* Register the protocol with Wireshark */
diff --git a/epan/dissectors/packet-mint.c b/epan/dissectors/packet-mint.c
index 3b2c65e8fd..80f612729e 100644
--- a/epan/dissectors/packet-mint.c
+++ b/epan/dissectors/packet-mint.c
@@ -545,25 +545,19 @@ dissect_mint_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int
dissect_mint_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint32 offset = 0;
- guint32 packet_length = tvb_length_remaining(tvb, 0);
+ guint32 packet_length = tvb_captured_length(tvb);
- offset += dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
+ return dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
PORT_MINT_CONTROL_TUNNEL);
-
- return offset;
}
static int
dissect_mint_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint32 offset = 0;
- guint32 packet_length = tvb_length_remaining(tvb, 0);
+ guint32 packet_length = tvb_captured_length(tvb);
- offset += dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
+ return dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
PORT_MINT_DATA_TUNNEL);
-
- return offset;
}
static int
diff --git a/epan/dissectors/packet-miop.c b/epan/dissectors/packet-miop.c
index 69b1a39cf2..0c35fab6cb 100644
--- a/epan/dissectors/packet-miop.c
+++ b/epan/dissectors/packet-miop.c
@@ -94,7 +94,7 @@ dissect_miop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
/* check magic number and version */
- tot_len = tvb_length(tvb);
+ tot_len = tvb_captured_length(tvb);
if (tot_len < MIOP_HEADER_SIZE) /* tot_len < 16 */
{
diff --git a/epan/dissectors/packet-mndp.c b/epan/dissectors/packet-mndp.c
index 8bf3472888..1830ed8823 100644
--- a/epan/dissectors/packet-mndp.c
+++ b/epan/dissectors/packet-mndp.c
@@ -220,7 +220,7 @@ dissect_mndp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME);
- packet_length = tvb_length(tvb);
+ packet_length = tvb_reported_length(tvb);
/* Header dissection */
ti = proto_tree_add_item(tree, proto_mndp, tvb, offset, -1,
@@ -246,7 +246,7 @@ static gboolean
test_mndp(tvbuff_t *tvb)
{
/* Minimum of 8 bytes, 4 Bytes header + 1 TLV-header */
- if ( tvb_length(tvb) < 8
+ if ( tvb_captured_length(tvb) < 8
|| tvb_get_guint8(tvb, 4) != 0
|| tvb_get_guint8(tvb, 6) != 0
) {
diff --git a/epan/dissectors/packet-mojito.c b/epan/dissectors/packet-mojito.c
index 693ecf3e87..12af54b6f4 100644
--- a/epan/dissectors/packet-mojito.c
+++ b/epan/dissectors/packet-mojito.c
@@ -698,7 +698,7 @@ static gboolean dissect_mojito_heuristic (tvbuff_t *tvb, packet_info *pinfo, pro
Test to make sure that the length field is there and correct
(tvb_get_letohl(tvb, 20) + 23) == tvb_length(tvb)
*/
- if ((tvb_length(tvb) >= 60) &&
+ if ((tvb_captured_length(tvb) >= 60) &&
(tvb_get_guint8(tvb, 16) == 68) &&
((tvb_get_letohl(tvb, 19) + 23) == tvb_reported_length(tvb)))
{
diff --git a/epan/dissectors/packet-moldudp64.c b/epan/dissectors/packet-moldudp64.c
index 9b4898004b..54353be90a 100644
--- a/epan/dissectors/packet-moldudp64.c
+++ b/epan/dissectors/packet-moldudp64.c
@@ -72,7 +72,7 @@ dissect_moldudp64_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint16 msglen, real_msglen, whole_len;
gint remaining;
- if (tvb_length_remaining(tvb, offset) < MOLDUDP64_MSGLEN_LEN)
+ if (tvb_captured_length_remaining(tvb, offset) < MOLDUDP64_MSGLEN_LEN)
return 0;
msglen = tvb_get_ntohs(tvb, offset);
diff --git a/epan/dissectors/packet-mpls-echo.c b/epan/dissectors/packet-mpls-echo.c
index 5587e2af7f..8bf527665c 100644
--- a/epan/dissectors/packet-mpls-echo.c
+++ b/epan/dissectors/packet-mpls-echo.c
@@ -1689,7 +1689,7 @@ dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
guint8 msgtype;
/* If version != 1 we assume it's not an mpls ping packet */
- if (tvb_length(tvb) < 5) {
+ if (tvb_captured_length(tvb) < 5) {
return 0; /* Not enough information to tell version and message type. */
}
if (tvb_get_ntohs(tvb, 0) != 1) {
diff --git a/epan/dissectors/packet-mrcpv2.c b/epan/dissectors/packet-mrcpv2.c
index 1c17698159..50deaac6ff 100644
--- a/epan/dissectors/packet-mrcpv2.c
+++ b/epan/dissectors/packet-mrcpv2.c
@@ -449,7 +449,7 @@ dissect_mrcpv2_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = 0;
if (tree) {
- tvb_len = tvb_length(tvb);
+ tvb_len = tvb_reported_length(tvb);
ti = proto_tree_add_item(tree, proto_mrcpv2, tvb, 0, -1, ENC_UTF_8);
mrcpv2_tree = proto_item_add_subtree(ti, ett_mrcpv2);
@@ -999,7 +999,7 @@ dissect_mrcpv2_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
gint sp_offset;
int value;
- len = tvb_length(tvb);
+ len = tvb_captured_length(tvb);
if (len < MRCPV2_MIN_LENGTH) /* too short, can't conclude if it's mrcp */
return 0;
diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c
index 9c756e7a4b..b50af560b7 100644
--- a/epan/dissectors/packet-msdp.c
+++ b/epan/dissectors/packet-msdp.c
@@ -227,7 +227,7 @@ dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- if (tvb_length_remaining(tvb, offset) > 0)
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
proto_tree_add_item(msdp_tree, hf_msdp_trailing_junk, tvb, offset, -1, ENC_NA);
return;
@@ -299,7 +299,7 @@ static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo,
ett_msdp_sa_enc_data, NULL, "Encapsulated IPv4 packet: %u bytes",
length);
- available_length = tvb_length_remaining(tvb, *offset);
+ available_length = tvb_captured_length_remaining(tvb, *offset);
reported_length = tvb_reported_length_remaining(tvb, *offset);
DISSECTOR_ASSERT(available_length >= 0);
DISSECTOR_ASSERT(reported_length >= 0);
diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c
index 5ef4d3dbde..d6e4f21ed6 100644
--- a/epan/dissectors/packet-msrp.c
+++ b/epan/dissectors/packet-msrp.c
@@ -345,7 +345,7 @@ check_msrp_header(tvbuff_t *tvb)
* is not longer than what's in the buffer, so the
* "tvb_get_ptr()" calls below won't throw exceptions. *
*/
- if(tvb_length(tvb) < 4 || tvb_get_ntohl(tvb, 0) != 0x4d535250 /* MSRP */){
+ if(tvb_captured_length(tvb) < 4 || tvb_get_ntohl(tvb, 0) != 0x4d535250 /* MSRP */){
return FALSE;
}
diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c
index 4291c4bdfd..5e9448c174 100644
--- a/epan/dissectors/packet-mstp.c
+++ b/epan/dissectors/packet-mstp.c
@@ -215,7 +215,7 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset+2, 1, ENC_LITTLE_ENDIAN);
item = proto_tree_add_item(subtree, hf_mstp_frame_pdu_len, tvb,
offset+3, 2, ENC_BIG_ENDIAN);
- mstp_tvb_pdu_len = tvb_length_remaining(tvb, offset+6);
+ mstp_tvb_pdu_len = tvb_reported_length_remaining(tvb, offset+6);
/* check the length - which does not include the crc16 checksum */
if (mstp_tvb_pdu_len > 2) {
if (mstp_frame_pdu_len > (mstp_tvb_pdu_len-2)) {
diff --git a/epan/dissectors/packet-mtp3mg.c b/epan/dissectors/packet-mtp3mg.c
index ba49820ee1..2eedc93963 100644
--- a/epan/dissectors/packet-mtp3mg.c
+++ b/epan/dissectors/packet-mtp3mg.c
@@ -431,7 +431,7 @@ dissect_mtp3mg_unknown_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
{
guint8 message_length;
- message_length = tvb_length(tvb);
+ message_length = tvb_captured_length(tvb);
proto_tree_add_expert_format(tree, pinfo, &ei_mtp3mg_unknown_message, tvb, 0, message_length,
"Unknown message (%u byte%s)", message_length,
plurality(message_length, "", "s"));
diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c
index 90f4e004bc..38c66e89fe 100644
--- a/epan/dissectors/packet-nbd.c
+++ b/epan/dissectors/packet-nbd.c
@@ -373,7 +373,7 @@ dissect_nbd_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
guint32 magic, type;
/* We need at least this much to tell whether this is NBD or not */
- if(tvb_length(tvb)<4){
+ if(tvb_captured_length(tvb)<4){
return FALSE;
}
@@ -382,7 +382,7 @@ dissect_nbd_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
switch(magic){
case NBD_REQUEST_MAGIC:
/* requests are 28 bytes or more */
- if(tvb_length(tvb)<28){
+ if(tvb_captured_length(tvb)<28){
return FALSE;
}
/* verify type */
@@ -400,7 +400,7 @@ dissect_nbd_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
return TRUE;
case NBD_RESPONSE_MAGIC:
/* responses are 16 bytes or more */
- if(tvb_length(tvb)<16){
+ if(tvb_captured_length(tvb)<16){
return FALSE;
}
tcp_dissect_pdus(tvb, pinfo, tree, nbd_desegment, 16, get_nbd_tcp_pdu_len, dissect_nbd_tcp_pdu, data);
diff --git a/epan/dissectors/packet-nbt.c b/epan/dissectors/packet-nbt.c
index 7a707747c1..65c01bc9e9 100644
--- a/epan/dissectors/packet-nbt.c
+++ b/epan/dissectors/packet-nbt.c
@@ -1538,7 +1538,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBSS");
col_clear(pinfo->cinfo, COL_INFO);
- max_data = tvb_length(tvb);
+ max_data = tvb_captured_length(tvb);
msg_type = tvb_get_guint8(tvb, offset);
@@ -1594,7 +1594,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
* So if it is a SESSION_MESSAGE and SMB1 or SMB2
* mark it as is_cifs.
*/
- if (tvb_length_remaining(tvb, offset) >= 8
+ if (tvb_captured_length_remaining(tvb, offset) >= 8
&& tvb_get_guint8(tvb,offset+0) == SESSION_MESSAGE
&& tvb_get_guint8(tvb,offset+5) == 'S'
&& tvb_get_guint8(tvb,offset+6) == 'M'
@@ -1762,7 +1762,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
* there is an SMB header there ...
*/
if( ((int)plen>tvb_reported_length_remaining(tvb, offset))
- &&(tvb_length_remaining(tvb, offset) >= 8)
+ &&(tvb_captured_length_remaining(tvb, offset) >= 8)
&&(tvb_get_guint8(tvb,offset+5) == 'S')
&&(tvb_get_guint8(tvb,offset+6) == 'M')
&&(tvb_get_guint8(tvb,offset+7) == 'B') ){
diff --git a/epan/dissectors/packet-ncp-sss.c b/epan/dissectors/packet-ncp-sss.c
index abd1710a8a..b367638741 100644
--- a/epan/dissectors/packet-ncp-sss.c
+++ b/epan/dissectors/packet-ncp-sss.c
@@ -419,7 +419,7 @@ sss_string(tvbuff_t* tvb, int hfinfo, proto_tree *sss_tree, int offset, gboolean
} else {
str_length = length;
}
- length_remaining = tvb_length_remaining(tvb, foffset);
+ length_remaining = tvb_captured_length_remaining(tvb, foffset);
if (length_remaining <= 0) {
return foffset;
}
@@ -475,7 +475,7 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp
proto_item *aitem;
- if (tvb_length_remaining(tvb, foffset)<4) {
+ if (tvb_reported_length_remaining(tvb, foffset)<4) {
return;
}
foffset = 6;
@@ -531,17 +531,17 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp
packets and then we will see these as malformed packets.
So check to make sure we still have data in the packet anytime
we read a secret. */
- if (tvb_length_remaining(tvb, foffset) > 4) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 4) {
/*foffset =*/ sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
}
break;
case 2:
foffset += 4;
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0);
- if (tvb_length_remaining(tvb, foffset) > 4) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 4) {
msg_length = tvb_get_letohl(tvb, foffset);
foffset += 4;
- if (tvb_length_remaining(tvb, foffset) < (gint) msg_length) {
+ if (tvb_captured_length_remaining(tvb, foffset) < (gint) msg_length) {
proto_tree_add_item(atree, hf_enc_data, tvb, foffset, -1, ENC_NA);
} else {
proto_tree_add_item(atree, hf_enc_data, tvb, foffset, msg_length, ENC_NA);
@@ -551,7 +551,7 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp
case 3:
case 4:
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0);
- if (tvb_length_remaining(tvb, foffset) > 4) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 4) {
/*foffset =*/ sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
}
break;
@@ -559,7 +559,7 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp
break;
case 6:
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0);
- if (tvb_length_remaining(tvb, foffset) > 4) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 4) {
/*foffset =*/ sss_string(tvb, hf_user, atree, foffset, TRUE, 0);
}
break;
@@ -580,7 +580,7 @@ dissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp
if (request_value) {
request_value->req_nds_flags=255;
}
- if (tvb_length_remaining(tvb, foffset) > 8) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 8) {
foffset += 4;
proto_tree_add_item(ncp_tree, hf_enc_data, tvb, foffset, -1, ENC_NA);
}
@@ -611,7 +611,7 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint
foffset = 8;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NSSS");
- if (tvb_length_remaining(tvb, foffset)<4) {
+ if (tvb_captured_length_remaining(tvb, foffset)<4) {
return;
}
atree = proto_tree_add_subtree_format(ncp_tree, tvb, foffset, -1, ett_sss, NULL, "Function: %s", val_to_str_const(subfunc, sss_func_enum, "Unknown"));
@@ -647,7 +647,7 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint
/*foffset+=4;*/
} else {
proto_tree_add_uint_format_value(atree, hf_return_code, tvb, foffset, 4, 0, "Success (0x00000000)");
- if (tvb_length_remaining(tvb, foffset) > 8) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 8) {
foffset += 4;
if (request_value && subverb == 6) {
foffset += 4;
@@ -655,25 +655,25 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint
foffset += 8;
for (i=0; i<number_of_items; i++) {
length_of_string = find_delimiter(tvb, foffset);
- if (length_of_string > tvb_length_remaining(tvb, foffset)) {
+ if (length_of_string > tvb_reported_length_remaining(tvb, foffset)) {
return;
}
foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, length_of_string);
- if (tvb_length_remaining(tvb, foffset) < 8) {
+ if (tvb_reported_length_remaining(tvb, foffset) < 8) {
return;
}
foffset++;
}
} else {
- proto_tree_add_item(atree, hf_enc_data, tvb, foffset, tvb_length_remaining(tvb, foffset), ENC_NA);
+ proto_tree_add_item(atree, hf_enc_data, tvb, foffset, tvb_captured_length_remaining(tvb, foffset), ENC_NA);
}
}
}
} else {
proto_tree_add_uint_format_value(atree, hf_return_code, tvb, foffset, 4, 0, "Success (0x00000000)");
- if (tvb_length_remaining(tvb, foffset) > 8) {
+ if (tvb_reported_length_remaining(tvb, foffset) > 8) {
foffset += 4;
- proto_tree_add_item(atree, hf_enc_data, tvb, foffset, tvb_length_remaining(tvb, foffset), ENC_NA);
+ proto_tree_add_item(atree, hf_enc_data, tvb, foffset, tvb_captured_length_remaining(tvb, foffset), ENC_NA);
}
}
break;
diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c
index 832251732d..ff3ff346d2 100644
--- a/epan/dissectors/packet-ncp.c
+++ b/epan/dissectors/packet-ncp.c
@@ -945,7 +945,7 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */
- length_remaining = tvb_length_remaining(tvb, commhdr + 4);
+ length_remaining = tvb_reported_length_remaining(tvb, commhdr + 4);
if (length_remaining > 4) {
testvar = tvb_get_ntohl(tvb, commhdr+4);
if (testvar == 0x4c495020) {
@@ -973,7 +973,7 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
switch (header.type) {
case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */
- length_remaining = tvb_length_remaining(tvb, commhdr + 4);
+ length_remaining = tvb_reported_length_remaining(tvb, commhdr + 4);
if (length_remaining > 4) {
testvar = tvb_get_ntohl(tvb, commhdr+4);
if (testvar == 0x4c495020) {
@@ -1088,7 +1088,7 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* length of the packet, but that's arguably a
* feature in this case.
*/
- length_remaining = tvb_length_remaining(tvb, offset);
+ length_remaining = tvb_captured_length_remaining(tvb, offset);
if (length_remaining > data_len)
length_remaining = data_len;
if (data_len != 0) {
@@ -1132,7 +1132,7 @@ get_ncp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U
*/
signature = tvb_get_ntohl(tvb, offset);
if (signature != NCPIP_RQST && signature != NCPIP_RPLY)
- return tvb_length_remaining(tvb, offset);
+ return tvb_captured_length_remaining(tvb, offset);
/*
* Get the length of the NCP-over-TCP packet. Strip off the "has
diff --git a/epan/dissectors/packet-negoex.c b/epan/dissectors/packet-negoex.c
index 8376ddb7bf..330f59781e 100644
--- a/epan/dissectors/packet-negoex.c
+++ b/epan/dissectors/packet-negoex.c
@@ -358,7 +358,7 @@ dissect_negoex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
negoex_tree = NULL;
tf = NULL;
done = FALSE;
- payload_len = tvb_length(tvb);
+ payload_len = tvb_reported_length(tvb);
/* Set up the initial NEGOEX payload */
if (tree) {
@@ -448,7 +448,7 @@ dissect_negoex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
msg_tvb = tvb_new_subset(tvb,
start_offset,
- MIN(message_len, tvb_length(tvb)),
+ MIN(message_len, tvb_captured_length(tvb)),
message_len);
switch (message_type) {
diff --git a/epan/dissectors/packet-netanalyzer.c b/epan/dissectors/packet-netanalyzer.c
index 367e4a6c0c..29941e47f2 100644
--- a/epan/dissectors/packet-netanalyzer.c
+++ b/epan/dissectors/packet-netanalyzer.c
@@ -240,7 +240,7 @@ dissect_netanalyzer_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (packet_status & MSK_ALIGN_ERR)
{
- proto_tree_add_expert(netanalyzer_header_tree, pinfo, &ei_netanalyzer_alignment_error, tvb, tvb_length(tvb)-1, 1);
+ proto_tree_add_expert(netanalyzer_header_tree, pinfo, &ei_netanalyzer_alignment_error, tvb, tvb_captured_length(tvb)-1, 1);
}
}
}
@@ -302,7 +302,7 @@ dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
tvbuff_t *next_tvb;
- if (tvb_length(tvb) >= 4)
+ if (tvb_reported_length(tvb) >= 4)
{
/* generate tvb subset for Ethernet frame */
if (dissect_netanalyzer_common(tvb, pinfo, tree))
@@ -328,7 +328,7 @@ dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
proto_tree *transparent_payload_tree = NULL;
tvbuff_t *next_tvb;
- if (tvb_length(tvb) >= 4)
+ if (tvb_reported_length(tvb) >= 4)
{
/* generate tvb subset for Ethernet frame */
if (dissect_netanalyzer_common(tvb, pinfo, tree))
@@ -337,7 +337,7 @@ dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
* as normally the transparent mode is used for low level analysis
* where dissecting the frame's content wouldn't make much sense
* use data dissector instead */
- transparent_payload_tree = proto_tree_add_subtree(tree, tvb, 4, tvb_length(tvb)-4,
+ transparent_payload_tree = proto_tree_add_subtree(tree, tvb, 4, tvb_captured_length(tvb)-4,
ett_netanalyzer_transparent, NULL, "Raw packet data");
next_tvb = tvb_new_subset_remaining(tvb, 4);
call_dissector(data_dissector_handle, next_tvb, pinfo, transparent_payload_tree);