diff options
author | Evan Huus <eapache@gmail.com> | 2015-06-23 11:13:21 -0700 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-06-23 18:13:41 +0000 |
commit | 9723c7a2f877f635f308c1534935ec4a90c661f8 (patch) | |
tree | 449c3aff0c2f004569356ee987a9906805d2f9b7 /epan/dissectors | |
parent | bc1472502f871d5d7d178f5588f9b5ed7a226180 (diff) |
Remove more deprecated tvb_length calls
Change-Id: Ie40a195db622ebfb096fa5088c5467a1385e69bf
Reviewed-on: https://code.wireshark.org/review/9062
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors')
30 files changed, 122 insertions, 122 deletions
diff --git a/epan/dissectors/packet-ehdlc.c b/epan/dissectors/packet-ehdlc.c index 2e367de4a7..44f5a190b8 100644 --- a/epan/dissectors/packet-ehdlc.c +++ b/epan/dissectors/packet-ehdlc.c @@ -135,7 +135,7 @@ dissect_ehdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Use MIN(...,...) in the following to prevent a premature */ /* exception before we try to dissect whatever is available. */ ti = proto_tree_add_protocol_format(tree, proto_ehdlc, - tvb, offset, MIN(len, tvb_length_remaining(tvb,offset)), + tvb, offset, MIN(len, tvb_captured_length_remaining(tvb,offset)), "Ericsson HDLC protocol, type: %s", val_to_str(msg_type, ehdlc_protocol_vals, "unknown 0x%02x")); diff --git a/epan/dissectors/packet-fcoib.c b/epan/dissectors/packet-fcoib.c index dfd7c493ab..15cabe95ba 100644 --- a/epan/dissectors/packet-fcoib.c +++ b/epan/dissectors/packet-fcoib.c @@ -210,7 +210,7 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U col_set_str(pinfo->cinfo, COL_PROTOCOL, "FCoIB"); - bytes_remaining = tvb_length_remaining(tvb, FCOIB_HEADER_LEN); + bytes_remaining = tvb_captured_length_remaining(tvb, FCOIB_HEADER_LEN); if (bytes_remaining > frame_len) bytes_remaining = frame_len; /* backing length */ next_tvb = tvb_new_subset(tvb, FCOIB_HEADER_LEN, bytes_remaining, frame_len); @@ -283,7 +283,7 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U crc, crc_computed); } proto_tree_set_appendix(fcoib_tree, tvb, crc_offset, - tvb_length_remaining (tvb, crc_offset)); + tvb_captured_length_remaining (tvb, crc_offset)); } else { item = proto_tree_add_uint_format_value(fcoib_tree, hf_fcoib_crc, tvb, crc_offset, 0, 0, "CRC: [missing]"); diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c index 2935a73515..8d2c88de5e 100644 --- a/epan/dissectors/packet-fcp.c +++ b/epan/dissectors/packet-fcp.c @@ -398,7 +398,7 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro proto_tree_add_item(tree, hf_fcp_rddata, tvb, offset+11, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_fcp_wrdata, tvb, offset+11, 1, ENC_BIG_ENDIAN); - tvb_len = tvb_length_remaining(tvb, offset+12); + tvb_len = tvb_captured_length_remaining(tvb, offset+12); if (tvb_len > (16 + add_len)) tvb_len = 16 + add_len; @@ -415,7 +415,7 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro } if ( ((rwflags & 0x03) == 0x03) - && tvb_length_remaining(tvb, offset+12+16+add_len+4) >= 4) { + && tvb_reported_length_remaining(tvb, offset+12+16+add_len+4) >= 4) { proto_tree_add_item(tree, hf_fcp_bidir_dl, tvb, offset+12+16+add_len+4, 4, ENC_BIG_ENDIAN); if (request_data->itlq) { @@ -547,7 +547,7 @@ dissect_fcp_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, prot if (rsplen) { tvbuff_t *rspinfo_tvb; - rspinfo_tvb = tvb_new_subset(tvb, offset, MIN(rsplen, tvb_length_remaining(tvb, offset)), rsplen); + rspinfo_tvb = tvb_new_subset(tvb, offset, MIN(rsplen, tvb_captured_length_remaining(tvb, offset)), rsplen); dissect_fcp_rspinfo(rspinfo_tvb, tree, 0); offset += rsplen; @@ -557,7 +557,7 @@ dissect_fcp_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, prot if (snslen) { tvbuff_t *sns_tvb; - sns_tvb = tvb_new_subset(tvb, offset, MIN(snslen, tvb_length_remaining(tvb, offset)), snslen); + sns_tvb = tvb_new_subset(tvb, offset, MIN(snslen, tvb_captured_length_remaining(tvb, offset)), snslen); dissect_scsi_snsinfo(sns_tvb, pinfo, parent_tree, 0, snslen, (request_data != NULL) ? request_data->itlq : &empty_itlq, &itl); @@ -716,7 +716,7 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) if (els) { dissect_fcp_els(tvb, pinfo, fcp_tree, fchdr); - return tvb_length(tvb); + return tvb_captured_length(tvb); } switch (r_ctl) { @@ -740,7 +740,7 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) break; } /*xxx once the subdissectors return bytes consumed: proto_item_set_end(ti, tvb, offset);*/ - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index 28a5e44506..1939afff09 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -388,7 +388,7 @@ static void dissect_fcsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { ti = proto_tree_add_protocol_format(tree, proto_fcsp, tvb, 0, - tvb_length(tvb), "FC-SP"); + tvb_captured_length(tvb), "FC-SP"); fcsp_tree = proto_item_add_subtree(ti, ett_fcsp); proto_tree_add_item(fcsp_tree, hf_auth_flags, tvb, offset+1, 1, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index aa7764ffad..327eba4281 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -1803,7 +1803,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) call_dissector(data_handle, next_tvb, pinfo, tree); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* Register the protocol with Wireshark */ diff --git a/epan/dissectors/packet-ff.c b/epan/dissectors/packet-ff.c index 9825b1ce07..fd72394436 100644 --- a/epan/dissectors/packet-ff.c +++ b/epan/dissectors/packet-ff.c @@ -11053,7 +11053,7 @@ dissect_ff(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) /*offset += trailer_len;*/ } - return tvb_length(tvb); + return tvb_captured_length(tvb); } @@ -11098,7 +11098,7 @@ dissect_ff_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) guint32 length; /* Make sure at least the header is there */ - if (tvb_length(tvb) < 12) + if (tvb_captured_length(tvb) < 12) return 0; length = tvb_get_ntohl(tvb, 8); diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c index 149f507475..ac2b21cea1 100644 --- a/epan/dissectors/packet-fix.c +++ b/epan/dissectors/packet-fix.c @@ -114,7 +114,7 @@ tag_search(int key) static int fix_next_header(tvbuff_t *tvb, int offset) { /* try to resync to the next start */ - guint min_len = tvb_length_remaining(tvb, offset); + guint min_len = tvb_captured_length_remaining(tvb, offset); const guint8 *data = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, min_len, ENC_ASCII); const guint8 *start = data; @@ -123,7 +123,7 @@ static int fix_next_header(tvbuff_t *tvb, int offset) /* if remaining length < 6 return and let the next desegment round test for 8=FIX */ - if (tvb_length_remaining(tvb, min_len + offset) < MARKER_LEN) + if (tvb_reported_length_remaining(tvb, min_len + offset) < MARKER_LEN) break; if (!fix_marker(tvb, min_len +offset) ) break; @@ -194,7 +194,7 @@ static int fix_header_len(tvbuff_t *tvb, int offset) * If the packet is big enough find the checksum */ size = atoi(value) +tag->ctrla_offset - base_offset +1; - if (tvb_length_remaining(tvb, base_offset) > size +4) { + if (tvb_reported_length_remaining(tvb, base_offset) > size +4) { /* 10= should be there */ offset = base_offset +size; if (tvb_strneql(tvb, offset, "10=", 3) != 0) { @@ -241,7 +241,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da ti = proto_tree_add_item(tree, proto_fix, tvb, 0, -1, ENC_NA); fix_tree = proto_item_add_subtree(ti, ett_fix); proto_tree_add_item(fix_tree, hf_fix_data, tvb, 0, -1, ENC_NA); - return tvb_length(tvb); + return tvb_captured_length(tvb); } pdu_len = tvb_reported_length(tvb); @@ -251,20 +251,20 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da /* begin string */ ctrla_offset = tvb_find_guint8(tvb, offset, -1, 0x01); if (ctrla_offset == -1) { - return tvb_length(tvb); + return tvb_captured_length(tvb); } offset = ctrla_offset + 1; /* msg length */ ctrla_offset = tvb_find_guint8(tvb, offset, -1, 0x01); if (ctrla_offset == -1) { - return tvb_length(tvb); + return tvb_captured_length(tvb); } offset = ctrla_offset + 1; /* msg type */ if (!(tag = fix_param(tvb, offset)) || tag->value_len < 1) { - return tvb_length(tvb); + return tvb_captured_length(tvb); } value = tvb_get_string_enc(wmem_packet_scope(), tvb, tag->value_offset, tag->value_len, ENC_ASCII); @@ -381,7 +381,7 @@ dissect_fix_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da tag_str = NULL; } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static guint @@ -411,7 +411,7 @@ dissect_fix_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data tcp_dissect_pdus(tvb, pinfo, tree, fix_desegment, FIX_MIN_LEN, get_fix_pdu_len, dissect_fix_packet, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int diff --git a/epan/dissectors/packet-fmtp.c b/epan/dissectors/packet-fmtp.c index fa0f2115fb..41ff17bbd0 100644 --- a/epan/dissectors/packet-fmtp.c +++ b/epan/dissectors/packet-fmtp.c @@ -125,7 +125,7 @@ dissect_fmtp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* call_dissector(data_handle, next_tvb, pinfo, fmtp_tree); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static guint diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index 86118074dc..6b97e3ae1e 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -892,7 +892,7 @@ dissect_ftpdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_fstr(pinfo->cinfo, COL_INFO, "FTP Data: %u bytes", tvb_reported_length(tvb)); - data_length = tvb_length(tvb); + data_length = tvb_captured_length(tvb); ti = proto_tree_add_item(tree, proto_ftp_data, tvb, 0, -1, ENC_NA); diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c index ba079d0f15..f2469c7a2f 100644 --- a/epan/dissectors/packet-gadu-gadu.c +++ b/epan/dissectors/packet-gadu-gadu.c @@ -590,7 +590,7 @@ gadu_gadu_strsize(tvbuff_t *tvb, const gint abs_offset) nul_offset = tvb_find_guint8(tvb, abs_offset, -1, 0); if (nul_offset == -1) - nul_offset = tvb_length(tvb) - 1; + nul_offset = tvb_captured_length(tvb) - 1; return (nul_offset - abs_offset) + 1; } @@ -1971,7 +1971,7 @@ dissect_gadu_gadu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* proto_tree_add_item(gadu_gadu_tree, &hfi_gadu_gadu_data, tvb, offset, -1, ENC_NA); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static guint @@ -1997,7 +1997,7 @@ dissect_gadu_gadu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat col_clear(pinfo->cinfo, COL_INFO); tcp_dissect_pdus(tvb, pinfo, tree, gadu_gadu_desegment, 8, get_gadu_gadu_pdu_len, dissect_gadu_gadu_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-gearman.c b/epan/dissectors/packet-gearman.c index 0ca13d440f..40980485c8 100644 --- a/epan/dissectors/packet-gearman.c +++ b/epan/dissectors/packet-gearman.c @@ -414,7 +414,7 @@ dissect_binary_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* } col_set_fence(pinfo->cinfo, COL_INFO); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static void @@ -479,7 +479,7 @@ dissect_gearman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) dissect_management_packet(tvb, pinfo, tree); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-ged125.c b/epan/dissectors/packet-ged125.c index 4966576a4b..f615d5eb92 100644 --- a/epan/dissectors/packet-ged125.c +++ b/epan/dissectors/packet-ged125.c @@ -1231,7 +1231,7 @@ dissect_ged125_base_messages(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree proto_tree_add_item(ged125_message_tree, hf_ged125_CallID, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; floating_fields(tvb, pinfo, ged125_tree, offset, size); - return tvb_length(tvb); + return tvb_captured_length(tvb); case GED125_ROUTE_SELECT_VALUE: proto_tree_add_item(ged125_message_tree, hf_ged125_CrossRefID, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -1277,7 +1277,7 @@ dissect_ged125_base_messages(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree } proto_item_set_len(message_item, offset-8); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -1286,7 +1286,7 @@ dissect_ged125(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) gint size; guint32 message_type; - size = tvb_length(tvb); + size = tvb_captured_length(tvb); if (size < 12) return 0; diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 4bfb1422c0..92f12ed1dc 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -4772,7 +4772,7 @@ static int dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree payload_tvb = tvb_new_subset_remaining (tvb, GIOP_HEADER_SIZE); call_dissector(data_handle, payload_tvb, pinfo, tree); - return tvb_length(tvb); + return tvb_captured_length(tvb); } switch (header.GIOP_version.minor) @@ -4818,7 +4818,7 @@ static int dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree { gint rem_len; - rem_len = tvb_length_remaining(tvb, GIOP_HEADER_SIZE); + rem_len = tvb_captured_length_remaining(tvb, GIOP_HEADER_SIZE); if (rem_len <= 0) return 8; @@ -4936,7 +4936,7 @@ static int dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree } /* switch message_type */ - return tvb_length(tvb); + return tvb_captured_length(tvb); } static guint @@ -4986,12 +4986,12 @@ dissect_giop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* if (!dissect_ziop_heur(tvb, pinfo, tree, NULL)) return 0; - return tvb_length(tvb); + return tvb_captured_length(tvb); } tcp_dissect_pdus(tvb, pinfo, tree, giop_desegment, GIOP_HEADER_SIZE, get_giop_pdu_len, dissect_giop_common, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static gboolean @@ -5004,7 +5004,7 @@ dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void /*define END_OF_GIOP_MESSAGE (offset - first_offset - GIOP_HEADER_SIZE) */ - tot_len = tvb_length(tvb); + tot_len = tvb_captured_length(tvb); if (tot_len < GIOP_HEADER_SIZE) /* tot_len < 12 */ { diff --git a/epan/dissectors/packet-git.c b/epan/dissectors/packet-git.c index a48654714b..42401a960e 100644 --- a/epan/dissectors/packet-git.c +++ b/epan/dissectors/packet-git.c @@ -108,7 +108,7 @@ dissect_git_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data plen-4, ENC_NA); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -116,7 +116,7 @@ dissect_git(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, git_desegment, 4, get_git_pdu_len, dissect_git_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-glbp.c b/epan/dissectors/packet-glbp.c index 9b7eac9c4a..e54ff72c9e 100644 --- a/epan/dissectors/packet-glbp.c +++ b/epan/dissectors/packet-glbp.c @@ -328,7 +328,7 @@ dissect_glbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 2; proto_tree_add_item(glbp_tree, hf_glbp_ownerid, tvb, offset, 6, ENC_NA); offset += 6; - while (tvb_length_remaining(tvb, offset) > 0) { + while (tvb_reported_length_remaining(tvb, offset) > 0) { type = tvb_get_guint8(tvb, offset); length = tvb_get_guint8(tvb, offset+1); @@ -381,7 +381,7 @@ static gboolean test_glbp(tvbuff_t *tvb, packet_info *pinfo) { guint32 unknown1; - if ( tvb_length(tvb) < 2) + if ( tvb_captured_length(tvb) < 2) return FALSE; unknown1 = tvb_get_guint8(tvb, 1); if (tvb_get_guint8(tvb, 0) != 1 /* version? */ diff --git a/epan/dissectors/packet-gmhdr.c b/epan/dissectors/packet-gmhdr.c index 6447c58ab0..274c1251f7 100644 --- a/epan/dissectors/packet-gmhdr.c +++ b/epan/dissectors/packet-gmhdr.c @@ -254,7 +254,7 @@ dissect_gmhdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_802_2 = TRUE; /* Don't throw an exception for this check (even a BoundsError) */ - if (tvb_length_remaining(tvb, offset) >= 2) { + if (tvb_captured_length_remaining(tvb, offset) >= 2) { if (tvb_get_ntohs(tvb, offset) == 0xffff) { is_802_2 = FALSE; } @@ -294,7 +294,7 @@ dissect_gmtimestamp_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t /* See if this packet has a Gigamon trailer, if yes, then decode it */ /* (Don't throw any exceptions while checking for the trailer). */ - tvblen = tvb_length(tvb); /* end+1 */ + tvblen = tvb_captured_length(tvb); /* end+1 */ if (tvblen < trailer_len) return 0; @@ -348,7 +348,7 @@ dissect_gmtrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void /* See if this packet has a Gigamon trailer, if yes, then decode it */ /* (Don't throw any exceptions while checking for the trailer). */ - tvblen = tvb_length(tvb); /* end+1 */ + tvblen = tvb_captured_length(tvb); /* end+1 */ if (tvblen < 5) return 0; extra_trailer = 0; diff --git a/epan/dissectors/packet-gmr1_bcch.c b/epan/dissectors/packet-gmr1_bcch.c index 8ee304e284..4dd1c30b5c 100644 --- a/epan/dissectors/packet-gmr1_bcch.c +++ b/epan/dissectors/packet-gmr1_bcch.c @@ -1039,7 +1039,7 @@ dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ); bcch_tree = proto_item_add_subtree(bcch_item, ett_gmr1_bcch); - csnStreamInit(&ar, 0, tvb_length(tvb)*8); + csnStreamInit(&ar, 0, tvb_captured_length(tvb)*8); /* SI1 or SI2 */ if (is_si1) { diff --git a/epan/dissectors/packet-gmr1_dtap.c b/epan/dissectors/packet-gmr1_dtap.c index bfee116cd3..0c0063f7c1 100644 --- a/epan/dissectors/packet-gmr1_dtap.c +++ b/epan/dissectors/packet-gmr1_dtap.c @@ -64,7 +64,7 @@ dissect_gmr1_dtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 pd; /* Scan init */ - len = tvb_length(tvb); + len = tvb_captured_length(tvb); offset = 0; /* Protocol descriptor */ diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index 5a65823e05..a49c5a7e78 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -1747,7 +1747,7 @@ dissect_add_ip_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN); address_tvb = tvb_new_subset(parameter_tvb, ADDRESS_PARAMETER_OFFSET, - MIN(address_length, tvb_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET)), + MIN(address_length, tvb_captured_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET)), MIN(address_length, tvb_reported_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET))); proto_item_append_text(parameter_item, " (Address: "); dissect_parameter(address_tvb, pinfo, parameter_tree, parameter_item, FALSE, FALSE); @@ -1764,7 +1764,7 @@ dissect_del_ip_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN); address_tvb = tvb_new_subset(parameter_tvb, ADDRESS_PARAMETER_OFFSET, - MIN(address_length, tvb_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET)), + MIN(address_length, tvb_captured_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET)), MIN(address_length, tvb_reported_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET))); proto_item_append_text(parameter_item, " (Address: "); dissect_parameter(address_tvb, pinfo, parameter_tree, parameter_item, FALSE, FALSE); @@ -1782,7 +1782,7 @@ dissect_error_cause_indication_parameter(tvbuff_t *parameter_tvb, packet_info *p proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN); causes_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH - CORRELATION_ID_LENGTH; causes_tvb = tvb_new_subset(parameter_tvb, ERROR_CAUSE_IND_CASUES_OFFSET, - MIN(causes_length, tvb_length_remaining(parameter_tvb, ERROR_CAUSE_IND_CASUES_OFFSET)), + MIN(causes_length, tvb_captured_length_remaining(parameter_tvb, ERROR_CAUSE_IND_CASUES_OFFSET)), MIN(causes_length, tvb_reported_length_remaining(parameter_tvb, ERROR_CAUSE_IND_CASUES_OFFSET))); dissect_error_causes(causes_tvb, pinfo, parameter_tree); } @@ -1797,7 +1797,7 @@ dissect_set_primary_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinf proto_tree_add_item(parameter_tree, hf_correlation_id, parameter_tvb, CORRELATION_ID_OFFSET, CORRELATION_ID_LENGTH, ENC_BIG_ENDIAN); address_tvb = tvb_new_subset(parameter_tvb, ADDRESS_PARAMETER_OFFSET, - MIN(address_length, tvb_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET)), + MIN(address_length, tvb_captured_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET)), MIN(address_length, tvb_reported_length_remaining(parameter_tvb, ADDRESS_PARAMETER_OFFSET))); proto_item_append_text(parameter_item, " (Address: "); dissect_parameter(address_tvb, pinfo, parameter_tree, parameter_item, FALSE, FALSE); @@ -2063,7 +2063,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre total_length = MIN(total_length, remaining_length); /* create a tvb for the parameter including the padding bytes */ - parameter_tvb = tvb_new_subset(parameters_tvb, offset, MIN(total_length, tvb_length_remaining(parameters_tvb, offset)), total_length); + parameter_tvb = tvb_new_subset(parameters_tvb, offset, MIN(total_length, tvb_captured_length_remaining(parameters_tvb, offset)), total_length); /* get rid of the handled parameter */ offset += total_length; remaining_length = tvb_reported_length_remaining(parameters_tvb, offset); @@ -2150,7 +2150,7 @@ dissect_unresolvable_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, prot parameter_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; parameter_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(parameter_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(parameter_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(parameter_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); proto_item_append_text(cause_item, " (Address: "); dissect_parameter(parameter_tvb, pinfo, cause_tree, cause_item, FALSE, FALSE); @@ -2169,7 +2169,7 @@ dissect_unrecognized_chunk_type_cause(tvbuff_t *cause_tvb, packet_info *pinfo, chunk_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; unrecognized_chunk_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(chunk_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(chunk_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(chunk_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); dissect_sctp_chunk(unrecognized_chunk_tvb, pinfo, cause_tree,cause_tree, NULL, FALSE); unrecognized_type = tvb_get_guint8(unrecognized_chunk_tvb, CHUNK_TYPE_OFFSET); @@ -2190,7 +2190,7 @@ dissect_unrecognized_parameters_cause(tvbuff_t *cause_tvb, packet_info *pinfo, p cause_info_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; unrecognized_parameters_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(cause_info_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(cause_info_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(cause_info_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); dissect_parameters(unrecognized_parameters_tvb, pinfo, cause_tree, NULL, FALSE); } @@ -2218,7 +2218,7 @@ dissect_restart_with_new_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, cause_info_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; parameter_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(cause_info_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(cause_info_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(cause_info_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); proto_item_append_text(cause_item, " (New addresses: "); dissect_parameters(parameter_tvb, pinfo, cause_tree, cause_item, FALSE); @@ -2253,7 +2253,7 @@ dissect_delete_last_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto cause_info_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; parameter_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(cause_info_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(cause_info_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(cause_info_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); proto_item_append_text(cause_item, " (Last address: "); dissect_parameter(parameter_tvb, pinfo, cause_tree, cause_item, FALSE, FALSE); @@ -2268,7 +2268,7 @@ dissect_resource_outage_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tre cause_info_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; parameter_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(cause_info_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(cause_info_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(cause_info_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); dissect_parameter(parameter_tvb, pinfo, cause_tree, NULL, FALSE, FALSE); } @@ -2281,7 +2281,7 @@ dissect_delete_source_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, pro cause_info_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; parameter_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(cause_info_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(cause_info_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(cause_info_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); proto_item_append_text(cause_item, " (Deleted address: "); dissect_parameter(parameter_tvb, pinfo, cause_tree, cause_item, FALSE, FALSE); @@ -2296,7 +2296,7 @@ dissect_request_refused_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tre cause_info_length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET) - CAUSE_HEADER_LENGTH; parameter_tvb = tvb_new_subset(cause_tvb, CAUSE_INFO_OFFSET, - MIN(cause_info_length, tvb_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), + MIN(cause_info_length, tvb_captured_length_remaining(cause_tvb, CAUSE_INFO_OFFSET)), MIN(cause_info_length, tvb_reported_length_remaining(cause_tvb, CAUSE_INFO_OFFSET))); dissect_parameter(parameter_tvb, pinfo, cause_tree, NULL, FALSE, FALSE); } @@ -2460,7 +2460,7 @@ dissect_error_causes(tvbuff_t *causes_tvb, packet_info *pinfo, proto_tree *tree) total_length = MIN(total_length, remaining_length); /* create a tvb for the parameter including the padding bytes */ - cause_tvb = tvb_new_subset(causes_tvb, offset, MIN(total_length, tvb_length_remaining(causes_tvb, offset)), total_length); + cause_tvb = tvb_new_subset(causes_tvb, offset, MIN(total_length, tvb_captured_length_remaining(causes_tvb, offset)), total_length); dissect_error_cause(cause_tvb, pinfo, tree); @@ -3328,7 +3328,7 @@ dissect_data_chunk(tvbuff_t *chunk_tvb, is_retransmission = sctp_tsn(pinfo, chunk_tvb, tsn_item, ha, tsn); payload_tvb = tvb_new_subset(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET, - MIN(chunk_length - DATA_CHUNK_HEADER_LENGTH, tvb_length_remaining(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET)), + MIN(chunk_length - DATA_CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET)), MIN(chunk_length - DATA_CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, DATA_CHUNK_PAYLOAD_OFFSET))); /* Is this a fragment? */ @@ -3462,7 +3462,7 @@ dissect_init_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo /* handle variable parameters */ chunk_length -= INIT_CHUNK_FIXED_PARAMTERS_LENGTH; parameters_tvb = tvb_new_subset(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET, - MIN(chunk_length, tvb_length_remaining(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET)), + MIN(chunk_length, tvb_captured_length_remaining(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET)), MIN(chunk_length, tvb_reported_length_remaining(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET))); dissect_parameters(parameters_tvb, pinfo, chunk_tree, NULL, TRUE); } @@ -3496,7 +3496,7 @@ dissect_init_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *p /* handle variable paramters */ chunk_length -= INIT_CHUNK_FIXED_PARAMTERS_LENGTH; parameters_tvb = tvb_new_subset(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET, - MIN(chunk_length, tvb_length_remaining(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET)), + MIN(chunk_length, tvb_captured_length_remaining(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET)), MIN(chunk_length, tvb_reported_length_remaining(chunk_tvb, INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET))); dissect_parameters(parameters_tvb, pinfo, chunk_tree, NULL, TRUE); } @@ -3829,7 +3829,7 @@ dissect_heartbeat_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info * if (chunk_tree) { proto_item_append_text(chunk_item, " (Information: %u byte%s)", chunk_length - CHUNK_HEADER_LENGTH, plurality(chunk_length - CHUNK_HEADER_LENGTH, "", "s")); parameter_tvb = tvb_new_subset(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET, - MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_length_remaining(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET)), + MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET)), MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET))); /* FIXME: Parameters or parameter? */ dissect_parameter(parameter_tvb, pinfo, chunk_tree, NULL, FALSE, TRUE); @@ -3844,7 +3844,7 @@ dissect_heartbeat_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_in if (chunk_tree) { proto_item_append_text(chunk_item, " (Information: %u byte%s)", chunk_length - CHUNK_HEADER_LENGTH, plurality(chunk_length - CHUNK_HEADER_LENGTH, "", "s")); parameter_tvb = tvb_new_subset(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET, - MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_length_remaining(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET)), + MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET)), MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, HEARTBEAT_CHUNK_INFO_OFFSET))); /* FIXME: Parameters or parameter? */ dissect_parameter(parameter_tvb, pinfo, chunk_tree, NULL, FALSE, TRUE); @@ -3867,7 +3867,7 @@ dissect_abort_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinf flags_tree = proto_item_add_subtree(flags_item, ett_sctp_abort_chunk_flags); proto_tree_add_item(flags_tree, hf_abort_chunk_t_bit, chunk_tvb, CHUNK_FLAGS_OFFSET, CHUNK_FLAGS_LENGTH, ENC_BIG_ENDIAN); causes_tvb = tvb_new_subset(chunk_tvb, CHUNK_VALUE_OFFSET, - MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_length_remaining(chunk_tvb, CHUNK_VALUE_OFFSET)), + MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, CHUNK_VALUE_OFFSET)), MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, CHUNK_VALUE_OFFSET))); dissect_error_causes(causes_tvb, pinfo, chunk_tree); } @@ -3899,7 +3899,7 @@ dissect_error_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinf if (chunk_tree) { causes_tvb = tvb_new_subset(chunk_tvb, ERROR_CAUSE_IND_CAUSES_OFFSET, - MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_length_remaining(chunk_tvb, ERROR_CAUSE_IND_CAUSES_OFFSET)), + MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, ERROR_CAUSE_IND_CAUSES_OFFSET)), MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, ERROR_CAUSE_IND_CAUSES_OFFSET))); dissect_error_causes(causes_tvb, pinfo, chunk_tree); } @@ -4007,7 +4007,7 @@ dissect_re_config_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info * tvbuff_t *parameters_tvb; parameters_tvb = tvb_new_subset(chunk_tvb, RE_CONFIG_PARAMETERS_OFFSET, - MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_length_remaining(chunk_tvb, RE_CONFIG_PARAMETERS_OFFSET)), + MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_captured_length_remaining(chunk_tvb, RE_CONFIG_PARAMETERS_OFFSET)), MIN(chunk_length - CHUNK_HEADER_LENGTH, tvb_reported_length_remaining(chunk_tvb, RE_CONFIG_PARAMETERS_OFFSET))); dissect_parameters(parameters_tvb, pinfo, chunk_tree, NULL, FALSE); } @@ -4050,7 +4050,7 @@ dissect_asconf_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pin } chunk_length -= CHUNK_HEADER_LENGTH + SCTP_SEQUENCE_NUMBER_LENGTH; parameters_tvb = tvb_new_subset(chunk_tvb, ASCONF_CHUNK_PARAMETERS_OFFSET, - MIN(chunk_length, tvb_length_remaining(chunk_tvb, ASCONF_CHUNK_PARAMETERS_OFFSET)), + MIN(chunk_length, tvb_captured_length_remaining(chunk_tvb, ASCONF_CHUNK_PARAMETERS_OFFSET)), MIN(chunk_length, tvb_reported_length_remaining(chunk_tvb, ASCONF_CHUNK_PARAMETERS_OFFSET))); dissect_parameters(parameters_tvb, pinfo, chunk_tree, NULL, FALSE); } @@ -4073,7 +4073,7 @@ dissect_asconf_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info } chunk_length -= CHUNK_HEADER_LENGTH + SCTP_SEQUENCE_NUMBER_LENGTH; parameters_tvb = tvb_new_subset(chunk_tvb, ASCONF_ACK_CHUNK_PARAMETERS_OFFSET, - MIN(chunk_length, tvb_length_remaining(chunk_tvb, ASCONF_ACK_CHUNK_PARAMETERS_OFFSET)), + MIN(chunk_length, tvb_captured_length_remaining(chunk_tvb, ASCONF_ACK_CHUNK_PARAMETERS_OFFSET)), MIN(chunk_length, tvb_reported_length_remaining(chunk_tvb, ASCONF_ACK_CHUNK_PARAMETERS_OFFSET))); dissect_parameters(parameters_tvb, pinfo, chunk_tree, NULL, FALSE); } @@ -4128,7 +4128,7 @@ dissect_pktdrop_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pi } chunk_length -= PKTDROP_CHUNK_HEADER_LENGTH; data_field_tvb = tvb_new_subset(chunk_tvb, PKTDROP_CHUNK_DATA_FIELD_OFFSET, - MIN(chunk_length, tvb_length_remaining(chunk_tvb, PKTDROP_CHUNK_DATA_FIELD_OFFSET)), + MIN(chunk_length, tvb_captured_length_remaining(chunk_tvb, PKTDROP_CHUNK_DATA_FIELD_OFFSET)), MIN(chunk_length, tvb_reported_length_remaining(chunk_tvb, PKTDROP_CHUNK_DATA_FIELD_OFFSET))); if (chunk_tree) { @@ -4377,7 +4377,7 @@ dissect_sctp_chunks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_i total_length = MIN(total_length, remaining_length); /* create a tvb for the chunk including the padding bytes */ - chunk_tvb = tvb_new_subset(tvb, offset, MIN(total_length, tvb_length_remaining(tvb, offset)), total_length); + chunk_tvb = tvb_new_subset(tvb, offset, MIN(total_length, tvb_captured_length_remaining(tvb, offset)), total_length); /* save it in the sctp_info structure */ if (!encapsulated) { diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 3d3aed08bd..659c813ede 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -560,7 +560,7 @@ dissect_sdp_connection_info(tvbuff_t *tvb, proto_item* ti, tokenlen = -1; /* end of tvbuff */ /* Save connection address */ media_info->connection_address = - (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_length_remaining(tvb, offset), ENC_UTF_8|ENC_NA); + (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_UTF_8|ENC_NA); } else { tokenlen = next_offset - offset; /* Save connection address */ @@ -773,7 +773,7 @@ static void dissect_key_mgmt(tvbuff_t *tvb, packet_info * pinfo, proto_item * ti offset = next_offset + 1; - len = tvb_length_remaining(tvb, offset); + len = tvb_captured_length_remaining(tvb, offset); if (len < 0) return; @@ -1219,7 +1219,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset proto_tree_add_expert_format(tree, pinfo, &ei_sdp_invalid_conversion, tvb, offset, tokenlen, "Could not convert '%s' to 3 bytes", format_specific_parameter); return; } - length = tvb_length(data_tvb); + length = tvb_reported_length(data_tvb); if (length == 3) { if (h264_handle && data_tvb) { dissect_h264_profile(data_tvb, pinfo, tree); @@ -1361,10 +1361,10 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto /* Skip colon */ offset = colon_offset + 1; /* skip leading wsp */ - offset = tvb_skip_wsp(tvb, offset, tvb_length_remaining(tvb, offset)); + offset = tvb_skip_wsp(tvb, offset, tvb_captured_length_remaining(tvb, offset)); /* Value is the remainder of the line */ - attribute_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_length_remaining(tvb, offset), ENC_UTF_8|ENC_NA); + attribute_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_UTF_8|ENC_NA); @@ -1453,7 +1453,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto guint8 media_format; /* Reading the Format parameter(fmtp) */ /* Skip leading space, if any */ - offset = tvb_skip_wsp(tvb, offset, tvb_length_remaining(tvb, offset)); + offset = tvb_skip_wsp(tvb, offset, tvb_captured_length_remaining(tvb, offset)); /* Media format extends to the next space */ next_offset = tvb_find_guint8(tvb, offset, -1, ' '); @@ -1483,11 +1483,11 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto while (has_more_pars == TRUE) { next_offset = tvb_find_guint8(tvb, offset, -1, ';'); - offset = tvb_skip_wsp(tvb, offset, tvb_length_remaining(tvb, offset)); + offset = tvb_skip_wsp(tvb, offset, tvb_captured_length_remaining(tvb, offset)); if (next_offset == -1) { has_more_pars = FALSE; - next_offset= tvb_length(tvb); + next_offset= tvb_captured_length(tvb); } /* There are at least 2 - add the first parameter */ @@ -1659,7 +1659,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto param_end_offset = tvb_find_guint8(tvb, offset, -1, ';'); if (param_end_offset == -1) { has_more_pars = FALSE; - param_end_offset = tvb_length(tvb); + param_end_offset = tvb_captured_length(tvb); } /* key-method or key-method-ext */ next_offset = tvb_find_guint8(tvb, offset, -1, ':'); @@ -2629,7 +2629,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - datalen = tvb_length_remaining(tvb, offset); + datalen = tvb_captured_length_remaining(tvb, offset); if (datalen > 0) { proto_tree_add_item(sdp_tree, hf_sdp_data, tvb, offset, datalen, ENC_NA); } diff --git a/epan/dissectors/packet-ubertooth.c b/epan/dissectors/packet-ubertooth.c index 847ed81e77..2b002a1b74 100644 --- a/epan/dissectors/packet-ubertooth.c +++ b/epan/dissectors/packet-ubertooth.c @@ -1321,9 +1321,9 @@ dissect_usb_rx_packet(proto_tree *main_tree, proto_tree *tree, packet_info *pinf call_dissector_with_data(bluetooth_ubertooth_handle, next_tvb, pinfo, main_tree, ubertooth_data); offset += length; - if (tvb_length_remaining(tvb, offset) > 0) { + if (tvb_reported_length_remaining(tvb, offset) > 0) { proto_tree_add_item(data_tree, hf_reserved, tvb, offset, -1, ENC_NA); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } break; @@ -1649,8 +1649,8 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat break; } - if (tvb_length_remaining(tvb, offset) > 0) { - proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, tvb_length_remaining(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) > 0) { + proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, tvb_captured_length_remaining(tvb, offset)); offset = tvb_captured_length(tvb); } @@ -1693,11 +1693,11 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat if (!command_data) { col_append_str(pinfo->cinfo, COL_INFO, "Response: Unknown"); - proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_length_remaining(tvb, offset)); + proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_captured_length_remaining(tvb, offset)); pinfo->p2p_dir = p2p_dir_save; - return tvb_length(tvb); + return tvb_captured_length(tvb); } col_append_fstr(pinfo->cinfo, COL_INFO, "Response: %s", @@ -1712,7 +1712,7 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat case 27: /* Spectrum Analyzer */ if (usb_conv_info->transfer_type == URB_BULK) { - while (tvb_length_remaining(tvb, offset) > 0) { + while (tvb_reported_length_remaining(tvb, offset) > 0) { offset = dissect_usb_rx_packet(tree, main_tree, pinfo, tvb, offset, command_response, usb_conv_info); } break; @@ -1752,9 +1752,9 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat case 56: /* BTLE Set Target */ case 58: /* Write Register */ proto_tree_add_expert(command_tree, pinfo, &ei_unexpected_response, tvb, offset, 0); - if (tvb_length_remaining(tvb, offset) > 0) { + if (tvb_reported_length_remaining(tvb, offset) > 0) { proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, -1); - offset = tvb_length(tvb); + offset = tvb_captured_length(tvb); } break; case 3: /* Get User LED */ @@ -1910,7 +1910,7 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat break; case 49: /* Poll */ - if (tvb_length_remaining(tvb, offset) == 1) { + if (tvb_reported_length_remaining(tvb, offset) == 1) { proto_tree_add_item(main_tree, hf_reserved, tvb, offset, 1, ENC_NA); offset += 1; break; @@ -1948,9 +1948,9 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat break; } - if (tvb_length_remaining(tvb, offset) > 0) { + if (tvb_reported_length_remaining(tvb, offset) > 0) { proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, -1); - offset = tvb_length(tvb); + offset = tvb_captured_length(tvb); } pinfo->p2p_dir = p2p_dir_save; diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c index fe97d55be6..0c174a8454 100644 --- a/epan/dissectors/packet-ucp.c +++ b/epan/dissectors/packet-ucp.c @@ -814,7 +814,7 @@ ucp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) idx = tvb_find_guint8(tvb, *offset, -1, '/'); if (idx == -1) { /* Force the appropriate exception to be thrown. */ - len = tvb_length_remaining(tvb, *offset); + len = tvb_captured_length_remaining(tvb, *offset); tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; @@ -898,7 +898,7 @@ ucp_handle_int(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) idx = tvb_find_guint8(tvb, *offset, -1, '/'); if (idx == -1) { /* Force the appropriate exception to be thrown. */ - len = tvb_length_remaining(tvb, *offset); + len = tvb_captured_length_remaining(tvb, *offset); tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; @@ -924,7 +924,7 @@ ucp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) idx = tvb_find_guint8(tvb, *offset, -1, '/'); if (idx == -1) { /* Force the appropriate exception to be thrown. */ - len = tvb_length_remaining(tvb, *offset); + len = tvb_captured_length_remaining(tvb, *offset); tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 58d54fa74d..7446279f9a 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -985,7 +985,7 @@ dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo, int offset, guint header_length) { int crc_size = 0; - int remain = tvb_length_remaining(tvb, offset); + int remain = tvb_captured_length_remaining(tvb, offset); /* Payload CRC (optional) */ if ((dch_crc_present == 1) || ((dch_crc_present == 2) && (remain >= 2))) { @@ -1529,7 +1529,7 @@ dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Info introduced in R6 */ /* only check if it looks as if they are present */ if (((p_fp_info->release == 6) || (p_fp_info->release == 7)) && - (tvb_length_remaining(tvb, offset) > 2)) + (tvb_reported_length_remaining(tvb, offset) > 2)) { int n; guint8 flags; @@ -1753,7 +1753,7 @@ dissect_fach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* New IE flags (if it looks as though they are present) */ if ((p_fp_info->release == 7) && - (tvb_length_remaining(tvb, offset) > 2)) { + (tvb_reported_length_remaining(tvb, offset) > 2)) { guint8 flags = tvb_get_guint8(tvb, offset); guint8 aoa_present = flags & 0x01; @@ -1915,7 +1915,7 @@ dissect_usch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* New IEs */ if ((p_fp_info->release == 7) && - (tvb_length_remaining(tvb, offset) > 2)) { + (tvb_reported_length_remaining(tvb, offset) > 2)) { guint8 flags = tvb_get_guint8(tvb, offset); guint8 bits_extended = flags & 0x01; @@ -2166,7 +2166,7 @@ dissect_dch_rx_timing_deviation(packet_info *pinfo, proto_tree *tree, /* May be extended in R7, but in this case there are at least 2 bytes remaining */ if ((p_fp_info->release == 7) && - (tvb_length_remaining(tvb, offset) >= 2)) { + (tvb_reported_length_remaining(tvb, offset) >= 2)) { /* New IE flags */ guint64 extended_bits_present; @@ -2361,7 +2361,7 @@ dissect_dch_timing_advance(proto_tree *tree, packet_info *pinfo, offset++; if ((p_fp_info->release == 7) && - (tvb_length_remaining(tvb, offset) > 0)) { + (tvb_reported_length_remaining(tvb, offset) > 0)) { /* New IE flags */ guint8 flags = tvb_get_guint8(tvb, offset); @@ -3213,7 +3213,7 @@ dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Extra IEs (if there is room for them) */ if (((p_fp_info->release == 6) || (p_fp_info->release == 7)) && - (tvb_length_remaining(tvb, offset) > 2)) { + (tvb_reported_length_remaining(tvb, offset) > 2)) { int n; guint8 flags; diff --git a/epan/dissectors/packet-usb-dfu.c b/epan/dissectors/packet-usb-dfu.c index 39e0930a2d..412f7c580b 100644 --- a/epan/dissectors/packet-usb-dfu.c +++ b/epan/dissectors/packet-usb-dfu.c @@ -291,8 +291,8 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) offset = tvb_captured_length(tvb); } - if (tvb_length_remaining(tvb, offset) > 0) { - proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, tvb_length_remaining(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) > 0) { + proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, tvb_captured_length_remaining(tvb, offset)); offset = tvb_captured_length(tvb); } @@ -336,7 +336,7 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) if (!command_data) { col_append_str(pinfo->cinfo, COL_INFO, "Response: Unknown"); - proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_length_remaining(tvb, offset)); + proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_captured_length_remaining(tvb, offset)); pinfo->p2p_dir = p2p_dir_save; @@ -404,7 +404,7 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) case 0x06: /* Abort */ default: proto_tree_add_expert(command_tree, pinfo, &ei_unexpected_response, tvb, offset, 0); - if (tvb_length_remaining(tvb, offset) > 0) { + if (tvb_reported_length_remaining(tvb, offset) > 0) { proto_tree_add_expert(main_tree, pinfo, &ei_unknown_data, tvb, offset, -1); offset = tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c index 2b50d63f75..0f9ae8a1c1 100644 --- a/epan/dissectors/packet-usb-hid.c +++ b/epan/dissectors/packet-usb-hid.c @@ -1299,20 +1299,20 @@ dissect_usb_hid_boot_mouse_input_report(tvbuff_t *tvb, packet_info *pinfo, proto offset += 1; /* not really in HID Specification */ - if (tvb_length_remaining(tvb, offset)) { + if (tvb_reported_length_remaining(tvb, offset)) { proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_horizontal_scroll_wheel, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; } /* not really in HID Specification */ - if (tvb_length_remaining(tvb, offset)) { + if (tvb_reported_length_remaining(tvb, offset)) { proto_tree_add_item(tree, hf_usbhid_boot_report_mouse_vertical_scroll_wheel, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; } - if (tvb_length_remaining(tvb, offset)) { + if (tvb_reported_length_remaining(tvb, offset)) { proto_tree_add_item(tree, hf_usbhid_data, tvb, offset, -1, ENC_NA); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } return offset; diff --git a/epan/dissectors/packet-wlccp.c b/epan/dissectors/packet-wlccp.c index 45395e41d9..b0bef0bcea 100644 --- a/epan/dissectors/packet-wlccp.c +++ b/epan/dissectors/packet-wlccp.c @@ -1007,7 +1007,7 @@ dissect_wlccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(get_tlv_flag() || get_mic_flag()) { - if (tvb_length_remaining(tvb,offset) < 4) + if (tvb_reported_length_remaining(tvb,offset) < 4) { /* something is wrong if the TLV flag is set and there's not enough left in the buffer */ @@ -1017,7 +1017,7 @@ dissect_wlccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { - while (tvb_length_remaining(tvb,offset) >= 4) + while (tvb_reported_length_remaining(tvb,offset) >= 4) { old_offset = offset; offset = dissect_wlccp_tlvs(wlccp_tree, tvb, offset, 0); diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c index 5f2491189f..a1e4bc91e4 100644 --- a/epan/dissectors/packet-yami.c +++ b/epan/dissectors/packet-yami.c @@ -522,7 +522,7 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } #define FRAME_HEADER_LEN 16 @@ -540,7 +540,7 @@ static int dissect_yami(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { tcp_dissect_pdus(tvb, pinfo, tree, yami_desegment, FRAME_HEADER_LEN, get_yami_message_len, dissect_yami_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-yhoo.c b/epan/dissectors/packet-yhoo.c index 2985934c5a..c024f06f25 100644 --- a/epan/dissectors/packet-yhoo.c +++ b/epan/dissectors/packet-yhoo.c @@ -184,7 +184,7 @@ dissect_yhoo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ } /* get at least a full packet structure */ - if ( tvb_length(tvb) < YAHOO_RAWPACKET_LEN ) { + if ( tvb_captured_length(tvb) < YAHOO_RAWPACKET_LEN ) { /* Not enough data captured; maybe it is a Yahoo Messenger packet, but it contains too little data to tell. */ diff --git a/epan/dissectors/packet-ymsg.c b/epan/dissectors/packet-ymsg.c index 661ef9c17a..09a002f1ab 100644 --- a/epan/dissectors/packet-ymsg.c +++ b/epan/dissectors/packet-ymsg.c @@ -330,7 +330,7 @@ static int get_content_item_length(tvbuff_t *tvb, int offset) int origoffset = offset; /* Keep reading until the magic delimiter (or end of tvb) is found */ - while (tvb_length_remaining(tvb, offset) >= 2) { + while (tvb_captured_length_remaining(tvb, offset) >= 2) { if (tvb_get_ntohs(tvb, offset) == 0xc080) { break; } diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c index 8ac3fe743b..d3291333cf 100644 --- a/epan/dissectors/packet-zbee-nwk-gp.c +++ b/epan/dissectors/packet-zbee-nwk-gp.c @@ -1275,11 +1275,11 @@ dissect_zbee_nwk_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee Green Power"); col_clear(pinfo->cinfo, COL_INFO); if (tree) { - proto_root = proto_tree_add_protocol_format(tree, proto_zbee_nwk_gp, tvb, offset, tvb_length(tvb), + proto_root = proto_tree_add_protocol_format(tree, proto_zbee_nwk_gp, tvb, offset, tvb_captured_length(tvb), "ZGP stub NWK header"); nwk_tree = proto_item_add_subtree(proto_root, ett_zbee_nwk); } - enc_buffer = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 0, tvb_length(tvb)); + enc_buffer = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 0, tvb_captured_length(tvb)); /* Get and parse the FCF. */ fcf = tvb_get_guint8(tvb, offset); packet.frame_type = zbee_get_bit_field(fcf, ZBEE_NWK_GP_FCF_FRAME_TYPE); @@ -1360,7 +1360,7 @@ dissect_zbee_nwk_gp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d } /* Save packet private data. */ data = (void *)&packet; - if ((offset < tvb_length(tvb)) && (packet.security_level != ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR)) { + if ((offset < tvb_captured_length(tvb)) && (packet.security_level != ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR)) { THROW(BoundsError); } if (packet.security_level == ZBEE_NWK_GP_SECURITY_LEVEL_FULLENCR) { |