diff options
author | Evan Huus <eapache@gmail.com> | 2015-06-22 09:59:50 -0700 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-06-22 20:43:34 +0000 |
commit | be6fb606915f4ccc68a62195619d176cd62f79f9 (patch) | |
tree | edd4b63c557923d1196dd779ac91ee1e1bae90ef | |
parent | 45872b9f7bf10476e48187f4b699c6f44943f22a (diff) |
Remove a bunch of deprecated tvb_length calls
Change-Id: I9362e0fdc4519ba5f3d656152966e7030f478839
Reviewed-on: https://code.wireshark.org/review/9022
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
49 files changed, 229 insertions, 229 deletions
diff --git a/epan/dissectors/packet-s5066dts.c b/epan/dissectors/packet-s5066dts.c index d99d9b9568..2655e4ee09 100644 --- a/epan/dissectors/packet-s5066dts.c +++ b/epan/dissectors/packet-s5066dts.c @@ -894,12 +894,12 @@ static int dissect_s5066dts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int dissect_s5066dts_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - guint b_length = tvb_length(tvb); + guint b_length = tvb_captured_length(tvb); /* Make sure there are enough bytes for a DPDU */ if ( b_length < S5066_DPDU_FRAME_HEADER_LEN){ @@ -922,7 +922,7 @@ static int dissect_s5066dts_raw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t static int dissect_s5066dts_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - guint b_length = tvb_length(tvb); + guint b_length = tvb_captured_length(tvb); /* Make sure there are enough bytes for a DPDU */ if ( b_length < S5066_DPDU_FRAME_HEADER_LEN){ diff --git a/epan/dissectors/packet-s5066sis.c b/epan/dissectors/packet-s5066sis.c index 5577080267..29829d3e1e 100644 --- a/epan/dissectors/packet-s5066sis.c +++ b/epan/dissectors/packet-s5066sis.c @@ -968,7 +968,7 @@ static int dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { /* Make sure there are enough bytes... */ - if (tvb_length(tvb) < 5) + if (tvb_captured_length(tvb) < 5) return 0; /* Check if the first two bytes are 0x90 0xEB: if not, then this is not a S5066 PDU or an unreassembled one. @@ -979,7 +979,7 @@ dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat return 0; } tcp_dissect_pdus(tvb, pinfo, tree, s5066_desegment, s5066_header_size, get_s5066_pdu_len, dissect_s5066_common, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -1048,7 +1048,7 @@ dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* Call sub dissector(s) */ reported_length = pdu_size - offset; - available_length = tvb_length(tvb) - offset; + available_length = tvb_captured_length(tvb) - offset; next_tvb = tvb_new_subset(tvb, offset, MIN(available_length, reported_length), reported_length); @@ -1056,7 +1056,7 @@ dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* call_dissector(data_handle, next_tvb, pinfo, tree); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-sametime.c b/epan/dissectors/packet-sametime.c index ccedc70d7a..3c686d728e 100644 --- a/epan/dissectors/packet-sametime.c +++ b/epan/dissectors/packet-sametime.c @@ -622,7 +622,7 @@ dissect_sametime_content(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo } tap_queue_packet(sametime_tap, pinfo, sinfo); - return tvb_length(tvb); + return tvb_captured_length(tvb); } @@ -672,7 +672,7 @@ get_sametime_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, /* because tcp_dissect_pdus was called with 4 as a required "fixed length". */ /* But newer variants of this protocol with a full encrypted network stream */ /* may require a more sophisticated dissection logic here */ - guint32 N = tvb_length_remaining(tvb, offset); + guint32 N = tvb_captured_length_remaining(tvb, offset); return (N < 4) ? N : tvb_get_ntohl(tvb, offset) + 4; } @@ -689,7 +689,7 @@ dissect_sametime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data tcp_dissect_pdus(tvb, pinfo, tree, global_sametime_reassemble_packets, 4, get_sametime_message_len, dissect_sametime_content, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-sap.c b/epan/dissectors/packet-sap.c index 9931fc3d8c..5665e86aaa 100644 --- a/epan/dissectors/packet-sap.c +++ b/epan/dissectors/packet-sap.c @@ -234,7 +234,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int pt_string_len; guint8* pt_str; - remaining_len = tvb_length_remaining(tvb, offset); + remaining_len = tvb_captured_length_remaining(tvb, offset); if (remaining_len == 0) { /* * "tvb_strneql()" failed because there was no diff --git a/epan/dissectors/packet-sbc.c b/epan/dissectors/packet-sbc.c index 769c118559..7bea4f69df 100644 --- a/epan/dissectors/packet-sbc.c +++ b/epan/dissectors/packet-sbc.c @@ -153,7 +153,7 @@ dissect_sbc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) number_of_frames = tvb_get_guint8(tvb, offset) & 0x0F; offset += 1; - while (tvb_length_remaining(tvb, offset) > 0) { + while (tvb_reported_length_remaining(tvb, offset) > 0) { byte = tvb_get_guint8(tvb, offset + 1); frequency = (byte & 0xC0) >> 6; blocks = (byte & 0x30) >> 4; diff --git a/epan/dissectors/packet-sbus.c b/epan/dissectors/packet-sbus.c index 52d65c45d8..0c8739de26 100644 --- a/epan/dissectors/packet-sbus.c +++ b/epan/dissectors/packet-sbus.c @@ -607,7 +607,7 @@ is_sbus_pdu(tvbuff_t *tvb) /* we need at least 8 bytes to determine whether this is sbus or not*/ - if(tvb_length(tvb)<8){ + if(tvb_captured_length(tvb)<8){ return FALSE; } diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index 5a32253a23..fe320c9405 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -827,7 +827,7 @@ sccp_called_calling_looks_valid(guint32 frame_num _U_, tvbuff_t *tvb, guint8 my_ { guint8 ai, ri, gti, ssni, pci; guint8 len_needed = 1; /* need at least the Address Indicator */ - guint len = tvb_length(tvb); + guint len = tvb_reported_length(tvb); ai = tvb_get_guint8(tvb, 0); if ((my_mtp3_standard == ANSI_STANDARD) && ((ai & ANSI_NATIONAL_MASK) == 0)) @@ -893,7 +893,7 @@ looks_like_valid_sccp(guint32 frame_num _U_, tvbuff_t *tvb, guint8 my_mtp3_stand guint data_ptr = 0; guint opt_ptr = 0; guint8 pointer_length = POINTER_LENGTH; - guint len = tvb_length(tvb); + guint len = tvb_captured_length(tvb); /* Ensure we can do some basic checks without throwing an exception. * Accesses beyond this length need to check the length first because @@ -1549,7 +1549,7 @@ dissect_sccp_unknown_message(tvbuff_t *message_tvb, proto_tree *sccp_tree) { guint32 message_length; - message_length = tvb_length(message_tvb); + message_length = tvb_captured_length(message_tvb); proto_tree_add_bytes_format(sccp_tree, hf_sccp_unknown_message, message_tvb, 0, message_length, NULL, "Unknown message (%u byte%s)", diff --git a/epan/dissectors/packet-skype.c b/epan/dissectors/packet-skype.c index 1e5ccf736c..8e2940ea28 100644 --- a/epan/dissectors/packet-skype.c +++ b/epan/dissectors/packet-skype.c @@ -132,7 +132,7 @@ dissect_skype_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* XXX: Just until we know how to decode skype over tcp */ packet_type = 255; - packet_length = tvb_length(tvb); + packet_length = tvb_captured_length(tvb); col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME); col_add_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type, @@ -187,7 +187,7 @@ dissect_skype_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) packet_type = tvb_get_guint8(tvb, 2) & SKYPE_SOM_TYPE_MASK; packet_unk = (tvb_get_guint8(tvb, 2) & SKYPE_SOM_UNK_MASK) >> 4; - packet_length = tvb_length(tvb); + packet_length = tvb_captured_length(tvb); col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME); col_add_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type, @@ -292,7 +292,7 @@ static gboolean test_skype_udp(tvbuff_t *tvb) { /* Minimum of 3 bytes, check for valid message type */ - guint length = tvb_length(tvb); + guint length = tvb_captured_length(tvb); guint8 type = tvb_get_guint8(tvb, 2) & 0xF; if ( length >= 3 && ( type == 0 || diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c index e079a65072..11c13087db 100644 --- a/epan/dissectors/packet-slsk.c +++ b/epan/dissectors/packet-slsk.c @@ -240,16 +240,16 @@ static gboolean check_slsk_format(tvbuff_t *tvb, int offset, const char format[] switch ( format[0] ) { case 'i': - if (tvb_length_remaining(tvb, offset) < 4) return FALSE; + if (tvb_captured_length_remaining(tvb, offset) < 4) return FALSE; offset += 4; break; case 'b': - if (tvb_length_remaining(tvb, offset) < 1) return FALSE; + if (tvb_captured_length_remaining(tvb, offset) < 1) return FALSE; offset += 1; break; case 's': - if (tvb_length_remaining(tvb, offset) < 4) return FALSE; - if (tvb_length_remaining(tvb, offset) < (int)tvb_get_letohl(tvb, offset)+4) return FALSE; + if (tvb_captured_length_remaining(tvb, offset) < 4) return FALSE; + if (tvb_captured_length_remaining(tvb, offset) < (int)tvb_get_letohl(tvb, offset)+4) return FALSE; offset += tvb_get_letohl(tvb, offset)+4; break; case '*': @@ -259,7 +259,7 @@ static gboolean check_slsk_format(tvbuff_t *tvb, int offset, const char format[] } if (format[1] == '\0' ) { - if (tvb_length_remaining(tvb, offset) > 0) /* Checks for additional bytes at the end */ + if (tvb_captured_length_remaining(tvb, offset) > 0) /* Checks for additional bytes at the end */ return FALSE; return TRUE; } @@ -465,7 +465,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 4; /* [zlib compressed] */ - comprlen = tvb_length_remaining(tvb, offset); + comprlen = tvb_captured_length_remaining(tvb, offset); if (slsk_decompress == TRUE){ @@ -474,7 +474,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (uncompr_tvb == NULL) { proto_tree_add_text(slsk_tree, tvb, offset, -1, "[zlib compressed packet]"); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); proto_tree_add_text(slsk_tree, tvb, 0, 0, "(uncompression failed !)"); } else { @@ -586,7 +586,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "[zlib compressed packet]"); proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, 0, 0, "( compressed packet length: %d)", comprlen); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } } break; @@ -626,16 +626,16 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 4; /* [zlib compressed] */ - comprlen = tvb_length_remaining(tvb, offset); + comprlen = tvb_captured_length_remaining(tvb, offset); if (slsk_decompress == TRUE){ tvbuff_t *uncompr_tvb = tvb_child_uncompress(tvb, tvb, offset, comprlen); if (uncompr_tvb == NULL) { - proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, tvb_length_remaining(tvb, offset), 0, + proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, tvb_captured_length_remaining(tvb, offset), 0, "[zlib compressed packet]"); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, 0, 0, 0, "(uncompression failed !)"); } else { @@ -645,7 +645,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, -1, 0, "( compressed packet length: %d)", comprlen); - uncomprlen = tvb_length_remaining(uncompr_tvb, 0); + uncomprlen = tvb_captured_length_remaining(uncompr_tvb, 0); proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, -1, 0, "(uncompressed packet length: %d)", uncomprlen); @@ -731,7 +731,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "[zlib compressed packet]"); proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, -1, 0, "( compressed packet length: %d)", comprlen); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } } break; @@ -1169,7 +1169,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 4; /* [zlib compressed] */ - comprlen = tvb_length_remaining(tvb, offset); + comprlen = tvb_captured_length_remaining(tvb, offset); if (slsk_decompress == TRUE){ @@ -1178,7 +1178,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (uncompr_tvb == NULL) { proto_tree_add_text(slsk_tree, tvb, offset, -1, "[zlib compressed packet]"); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); proto_tree_add_text(slsk_tree, tvb, 0, 0, "[uncompression failed !]"); } else { @@ -1188,7 +1188,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, -1, 0, "[compressed packet length: %d]", comprlen); - uncomprlen = tvb_length_remaining(uncompr_tvb, 0); + uncomprlen = tvb_captured_length_remaining(uncompr_tvb, 0); proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, -1, 0, "[uncompressed packet length: %d]", uncomprlen); @@ -1297,7 +1297,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "[zlib compressed packet]"); proto_tree_add_uint_format(slsk_tree, hf_slsk_integer, tvb, offset, -1, 0, "( compressed packet length: %d)", comprlen); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } } break; @@ -1354,7 +1354,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "Download allowed: %s (Byte: %d)", val_to_str_const(tvb_get_guint8(tvb, offset), slsk_yes_no, "Unknown"), tvb_get_guint8(tvb, offset)); offset += 1; if ( i == 1 ) { - if ( tvb_length_remaining(tvb, offset) == 8 ) { + if ( tvb_reported_length_remaining(tvb, offset) == 8 ) { proto_tree_add_uint(slsk_tree, hf_slsk_size, tvb, offset, 4, tvb_get_letohl(tvb, offset)); offset += 4; proto_tree_add_uint(slsk_tree, hf_slsk_integer, tvb, offset, 4, tvb_get_letohl(tvb, offset)); @@ -2380,14 +2380,14 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, expert_add_info(pinfo, ti_len, &ei_slsk_unknown_data); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int dissect_slsk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, slsk_desegment, 4, get_slsk_pdu_len, dissect_slsk_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c index 3b8d265e98..bfb715949d 100644 --- a/epan/dissectors/packet-smb-pipe.c +++ b/epan/dissectors/packet-smb-pipe.c @@ -2522,7 +2522,7 @@ dissect_response_data(tvbuff_t *tvb, packet_info *pinfo, int convert, } else { proto_tree_add_item(data_tree, hf_data_no_descriptor, tvb, offset, -1, ENC_NA); } - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } else { /* * If we have an entry count, show all the entries, @@ -3276,7 +3276,7 @@ dissect_pipe_dcerpc(tvbuff_t *d_tvb, packet_info *pinfo, proto_tree *parent_tree pinfo->desegment_offset = 0; pinfo->desegment_len = 0; reported_len = tvb_reported_length(d_tvb); - if(smb_dcerpc_reassembly && tvb_length(d_tvb) >= reported_len){ + if(smb_dcerpc_reassembly && tvb_captured_length(d_tvb) >= reported_len){ pinfo->can_desegment=2; } @@ -3520,7 +3520,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, * anything.) */ if (sp_tvb != NULL) - sp_len = tvb_length(sp_tvb); + sp_len = tvb_captured_length(sp_tvb); else sp_len = 0; if (tree) { @@ -3533,7 +3533,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, /* * Do we have any setup words at all? */ - if (s_tvb != NULL && tvb_length(s_tvb) != 0) { + if (s_tvb != NULL && tvb_reported_length(s_tvb) != 0) { /* * Yes. The first of them is the function. */ diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index c5afb95ce0..620e35d845 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -1008,7 +1008,7 @@ dissect_smb2_olb_string(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *t offset = olb->off; len = olb->len; off = olb->off; - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); /* sanity check */ @@ -1137,7 +1137,7 @@ dissect_smb2_olb_buffer(packet_info *pinfo, proto_tree *parent_tree, tvbuff_t *t return; } - sub_tvb = tvb_new_subset(tvb, off, MIN((int)len, tvb_length_remaining(tvb, off)), len); + sub_tvb = tvb_new_subset(tvb, off, MIN((int)len, tvb_captured_length_remaining(tvb, off)), len); dissector(sub_tvb, pinfo, sub_tree, si); } @@ -1661,7 +1661,7 @@ dissect_smb2_file_all_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pa /* file name */ if (length) { - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); name = get_unicode_or_ascii_string(tvb, &offset, TRUE, &length, TRUE, TRUE, &bc); if (name) { @@ -1689,7 +1689,7 @@ dissect_smb2_file_allocation_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t tree = proto_item_add_subtree(item, ett_smb2_file_allocation_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qsfi_SMB_FILE_ALLOCATION_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1708,7 +1708,7 @@ dissect_smb2_file_endoffile_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr tree = proto_item_add_subtree(item, ett_smb2_file_endoffile_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qsfi_SMB_FILE_ENDOFFILE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1727,7 +1727,7 @@ dissect_smb2_file_alternate_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, pro tree = proto_item_add_subtree(item, ett_smb2_file_alternate_name_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_NAME_INFO(tvb, pinfo, tree, offset, &bc, &trunc, /* XXX assumption hack */ TRUE); return offset; @@ -1780,7 +1780,7 @@ dissect_smb2_file_standard_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre tree = proto_item_add_subtree(item, ett_smb2_file_standard_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_STANDARD_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1798,7 +1798,7 @@ dissect_smb2_file_internal_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre tree = proto_item_add_subtree(item, ett_smb2_file_internal_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_INTERNAL_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1816,7 +1816,7 @@ dissect_smb2_file_mode_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *p tree = proto_item_add_subtree(item, ett_smb2_file_mode_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qsfi_SMB_FILE_MODE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1834,7 +1834,7 @@ dissect_smb2_file_alignment_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr tree = proto_item_add_subtree(item, ett_smb2_file_alignment_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_ALIGNMENT_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1852,7 +1852,7 @@ dissect_smb2_file_position_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre tree = proto_item_add_subtree(item, ett_smb2_file_position_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qsfi_SMB_FILE_POSITION_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1888,7 +1888,7 @@ dissect_smb2_file_ea_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *par tree = proto_item_add_subtree(item, ett_smb2_file_ea_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_EA_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1907,7 +1907,7 @@ dissect_smb2_file_stream_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree tree = proto_item_add_subtree(item, ett_smb2_file_stream_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_STREAM_INFO(tvb, pinfo, tree, offset, &bc, &trunc, TRUE); return offset; @@ -1926,7 +1926,7 @@ dissect_smb2_file_pipe_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *p tree = proto_item_add_subtree(item, ett_smb2_file_pipe_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_sfi_SMB_FILE_PIPE_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1945,7 +1945,7 @@ dissect_smb2_file_compression_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ tree = proto_item_add_subtree(item, ett_smb2_file_compression_info); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_COMPRESSION_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1965,7 +1965,7 @@ dissect_smb2_file_network_open_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_NETWORK_OPEN_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -1985,7 +1985,7 @@ dissect_smb2_file_attribute_tag_info(tvbuff_t *tvb, packet_info *pinfo _U_, prot } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfi_SMB_FILE_ATTRIBUTE_TAG_INFO(tvb, pinfo, tree, offset, &bc, &trunc); return offset; @@ -2060,7 +2060,7 @@ dissect_smb2_file_full_ea_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree /* ea name */ length = ea_name_len; if (length) { - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); name = get_unicode_or_ascii_string(tvb, &offset, FALSE, &length, TRUE, TRUE, &bc); if (name) { @@ -2075,7 +2075,7 @@ dissect_smb2_file_full_ea_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree /* ea data */ length = ea_data_len; if (length) { - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); data = get_unicode_or_ascii_string(tvb, &offset, FALSE, &length, TRUE, TRUE, &bc); /* @@ -2142,7 +2142,7 @@ dissect_smb2_file_rename_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree /* file name */ if (length) { - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); name = get_unicode_or_ascii_string(tvb, &offset, TRUE, &length, TRUE, TRUE, &bc); if (name) { @@ -2169,7 +2169,7 @@ dissect_smb2_sec_info_00(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pare } /* security descriptor */ - offset = dissect_nt_sec_desc(tvb, offset, pinfo, tree, NULL, TRUE, tvb_length_remaining(tvb, offset), NULL); + offset = dissect_nt_sec_desc(tvb, offset, pinfo, tree, NULL, TRUE, tvb_captured_length_remaining(tvb, offset), NULL); return offset; } @@ -2186,7 +2186,7 @@ dissect_smb2_fs_info_05(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren tree = proto_item_add_subtree(item, ett_smb2_fs_info_05); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfsi_FS_ATTRIBUTE_INFO(tvb, pinfo, tree, offset, &bc, TRUE); return offset; @@ -2204,7 +2204,7 @@ dissect_smb2_fs_info_06(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren tree = proto_item_add_subtree(item, ett_smb2_fs_info_06); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_nt_quota(tvb, tree, offset, &bc); return offset; @@ -2239,7 +2239,7 @@ dissect_smb2_fs_info_07(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren tree = proto_item_add_subtree(item, ett_smb2_fs_info_07); } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfsi_FS_FULL_SIZE_INFO(tvb, pinfo, tree, offset, &bc); return offset; @@ -2258,7 +2258,7 @@ dissect_smb2_fs_info_01(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfsi_FS_VOLUME_INFO(tvb, pinfo, tree, offset, &bc, TRUE); return offset; @@ -2277,7 +2277,7 @@ dissect_smb2_fs_info_03(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfsi_FS_SIZE_INFO(tvb, pinfo, tree, offset, &bc); return offset; @@ -2296,7 +2296,7 @@ dissect_smb2_fs_info_04(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren } - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); offset = dissect_qfsi_FS_DEVICE_INFO(tvb, pinfo, tree, offset, &bc); return offset; @@ -2504,7 +2504,7 @@ dissect_smb2_share_caps(proto_tree *tree, tvbuff_t *tvb, int offset) static void dissect_smb2_secblob(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) { - if ((tvb_length(tvb)>=7) + if ((tvb_captured_length(tvb)>=7) && (!tvb_memeql(tvb, 0, "NTLMSSP", 7))) { call_dissector(ntlmssp_handle, tvb, pinfo, tree); } else { @@ -2912,7 +2912,7 @@ dissect_smb2_notify_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static void dissect_smb2_notify_data_out(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, smb2_info_t *si _U_) { - proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), ENC_NA); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); } static int @@ -3013,7 +3013,7 @@ static void dissect_smb2_file_directory_info(tvbuff_t *tvb, packet_info *pinfo _ const char *name = NULL; guint16 bc; - while (tvb_length_remaining(tvb, offset) > 4) { + while (tvb_reported_length_remaining(tvb, offset) > 4) { int old_offset = offset; int next_offset; int file_name_len; @@ -3096,7 +3096,7 @@ static void dissect_smb2_full_directory_info(tvbuff_t *tvb, packet_info *pinfo _ const char *name = NULL; guint16 bc; - while (tvb_length_remaining(tvb, offset) > 4) { + while (tvb_reported_length_remaining(tvb, offset) > 4) { int old_offset = offset; int next_offset; int file_name_len; @@ -3183,7 +3183,7 @@ static void dissect_smb2_both_directory_info(tvbuff_t *tvb, packet_info *pinfo _ const char *name = NULL; guint16 bc; - while (tvb_length_remaining(tvb, offset) > 4) { + while (tvb_reported_length_remaining(tvb, offset) > 4) { int old_offset = offset; int next_offset; int file_name_len; @@ -3291,7 +3291,7 @@ static void dissect_smb2_file_name_info(tvbuff_t *tvb, packet_info *pinfo _U_, p const char *name = NULL; guint16 bc; - while (tvb_length_remaining(tvb, offset) > 4) { + while (tvb_reported_length_remaining(tvb, offset) > 4) { int old_offset = offset; int next_offset; int file_name_len; @@ -3351,7 +3351,7 @@ static void dissect_smb2_id_both_directory_info(tvbuff_t *tvb, packet_info *pinf const char *name = NULL; guint16 bc; - while (tvb_length_remaining(tvb, offset) > 4) { + while (tvb_reported_length_remaining(tvb, offset) > 4) { int old_offset = offset; int next_offset; int file_name_len; @@ -3488,7 +3488,7 @@ dissect_smb2_find_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2 dis++; } - proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), ENC_NA); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); } static int @@ -3756,7 +3756,7 @@ dissect_smb2_getinfo_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre default: /* we don't handle this infolevel yet */ proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, ENC_NA); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } break; case SMB2_CLASS_FS_INFO: @@ -3764,7 +3764,7 @@ dissect_smb2_getinfo_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre default: /* we don't handle this infolevel yet */ proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, ENC_NA); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } break; case SMB2_CLASS_SEC_INFO: @@ -3775,13 +3775,13 @@ dissect_smb2_getinfo_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre default: /* we don't handle this infolevel yet */ proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, ENC_NA); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } break; default: /* we don't handle this class yet */ proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, 16, ENC_NA); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } return offset; } @@ -3953,8 +3953,8 @@ dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; default: /* we don't handle this infolevel yet */ - proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); - offset += tvb_length_remaining(tvb, offset); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); + offset += tvb_captured_length_remaining(tvb, offset); } break; case SMB2_CLASS_FS_INFO: @@ -3982,8 +3982,8 @@ dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; default: /* we don't handle this infolevel yet */ - proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); - offset += tvb_length_remaining(tvb, offset); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); + offset += tvb_captured_length_remaining(tvb, offset); } break; case SMB2_CLASS_SEC_INFO: @@ -3993,14 +3993,14 @@ dissect_smb2_infolevel(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; default: /* we don't handle this infolevel yet */ - proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); - offset += tvb_length_remaining(tvb, offset); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); + offset += tvb_captured_length_remaining(tvb, offset); } break; default: /* we don't handle this class yet */ - proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); - offset += tvb_length_remaining(tvb, offset); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); + offset += tvb_captured_length_remaining(tvb, offset); } /* if we get BUFFER_OVERFLOW there will be truncated data */ @@ -4020,7 +4020,7 @@ dissect_smb2_getinfo_response_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree dissect_smb2_infolevel(tvb, pinfo, tree, 0, si, si->saved->smb2_class, si->saved->infolevel); } else { /* some unknown bytes */ - proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), ENC_NA); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); } } @@ -4287,7 +4287,7 @@ dissect_file_data_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_ tvbuff_t *dcerpc_tvb; heur_dtbl_entry_t *hdtbl_entry; - dcerpc_tvb = tvb_new_subset(tvb, offset, MIN((int)datalen, tvb_length_remaining(tvb, offset)), datalen); + dcerpc_tvb = tvb_new_subset(tvb, offset, MIN((int)datalen, tvb_captured_length_remaining(tvb, offset)), datalen); /* dissect the full PDU */ dissector_try_heuristic(smb2_heur_subdissector_list, dcerpc_tvb, pinfo, top_tree, &hdtbl_entry, NULL); @@ -4422,9 +4422,9 @@ dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* just ordinary data */ proto_tree_add_item(tree, hf_smb2_write_data, tvb, offset, length, ENC_NA); - data_tvb_len=(guint32)tvb_length_remaining(tvb, offset); + data_tvb_len=(guint32)tvb_captured_length_remaining(tvb, offset); - offset += MIN(length,(guint32)tvb_length_remaining(tvb, offset)); + offset += MIN(length,(guint32)tvb_captured_length_remaining(tvb, offset)); offset = dissect_smb2_olb_tvb_max_offset(offset, &c_olb); @@ -4475,7 +4475,7 @@ dissect_smb2_write_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t static void dissect_smb2_FSCTL_PIPE_TRANSCEIVE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *top_tree, gboolean data_in _U_) { - dissect_file_data_dcerpc(tvb, pinfo, tree, offset, tvb_length_remaining(tvb, offset), top_tree); + dissect_file_data_dcerpc(tvb, pinfo, tree, offset, tvb_captured_length_remaining(tvb, offset), top_tree); } static void @@ -4814,7 +4814,7 @@ dissect_smb2_FSCTL_GET_SHADOW_COPY_DATA(tvbuff_t *tvb, packet_info *pinfo _U_, p int len = 0; int old_offset = offset; - bc = tvb_length_remaining(tvb, offset); + bc = tvb_captured_length_remaining(tvb, offset); name = get_unicode_or_ascii_string(tvb, &offset, TRUE, &len, TRUE, FALSE, &bc); proto_tree_add_string(tree, hf_smb2_ioctl_shadow_copy_label, tvb, old_offset, len, name); @@ -5031,7 +5031,7 @@ dissect_smb2_ioctl_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pro dissect_smb2_FSCTL_SET_INTEGRITY_INFORMATION(tvb, pinfo, tree, 0, data_in); break; default: - proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_length(tvb), ENC_NA); + proto_tree_add_item(tree, hf_smb2_unknown, tvb, 0, tvb_captured_length(tvb), ENC_NA); } } @@ -5288,7 +5288,7 @@ dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* data */ proto_tree_add_item(tree, hf_smb2_read_data, tvb, offset, length, ENC_NA); - data_tvb_len=(guint32)tvb_length_remaining(tvb, offset); + data_tvb_len=(guint32)tvb_captured_length_remaining(tvb, offset); offset += MIN(length,data_tvb_len); @@ -5368,7 +5368,7 @@ dissect_smb2_QFid_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr } if (item) { - if (tvb_length(tvb) == 0) { + if (tvb_reported_length(tvb) == 0) { proto_item_append_text(item, ": NO DATA"); } else { proto_item_append_text(item, ": QFid request should have no data, malformed packet"); @@ -5541,7 +5541,7 @@ dissect_smb2_MxAc_buffer_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr item = proto_tree_get_parent(tree); } - if (tvb_length(tvb) == 0) { + if (tvb_reported_length(tvb) == 0) { if (item) { proto_item_append_text(item, ": NO DATA"); } @@ -5564,7 +5564,7 @@ dissect_smb2_MxAc_buffer_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_t item = proto_tree_get_parent(tree); - if (tvb_length(tvb) == 0) { + if (tvb_reported_length(tvb) == 0) { proto_item_append_text(item, ": NO DATA"); return; } @@ -5625,16 +5625,16 @@ dissect_SMB2_CREATE_LEASE_VX(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * parent_item = proto_tree_get_parent(parent_tree); - len = tvb_length(tvb); + len = tvb_reported_length(tvb); switch (len) { case 32: /* SMB2_CREATE_REQUEST/RESPONSE_LEASE */ proto_item_append_text(parent_item, ": LEASE_V1"); - sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_smb2_RqLs_buffer, NULL, "LEASE_V1"); + sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_smb2_RqLs_buffer, NULL, "LEASE_V1"); break; case 52: /* SMB2_CREATE_REQUEST/RESPONSE_LEASE_V2 */ proto_item_append_text(parent_item, ": LEASE_V2"); - sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, len, ett_smb2_RqLs_buffer, NULL, "LEASE_V2"); + sub_tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_smb2_RqLs_buffer, NULL, "LEASE_V2"); break; default: report_create_context_malformed_buffer(tvb, pinfo, parent_tree, "RqLs"); @@ -7061,7 +7061,7 @@ dissect_smb2_command(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int of offset = (*cmd_dissector)(tvb, pinfo, cmd_tree, offset, si); } else { proto_tree_add_item(cmd_tree, hf_smb2_unknown, tvb, offset, -1, ENC_NA); - offset = tvb_length(tvb); + offset = tvb_captured_length(tvb); } proto_item_set_len(cmd_item, offset-old_offset); @@ -7470,7 +7470,7 @@ dissect_smb2_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo { /* must check that this really is a smb2 packet */ - if (tvb_length(tvb) < 4) + if (tvb_captured_length(tvb) < 4) return FALSE; if (((tvb_get_guint8(tvb, 0) != 0xfe) && (tvb_get_guint8(tvb, 0) != 0xfd)) diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index 5d54bc16b1..9528249163 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -2403,7 +2403,7 @@ dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) guint32 offset = 0; while (tvb_reported_length_remaining(tvb, offset) > 0) { guint16 pdu_len = tvb_get_ntohl(tvb, offset); - gint pdu_real_len = tvb_length_remaining(tvb, offset); + gint pdu_real_len = tvb_captured_length_remaining(tvb, offset); tvbuff_t *pdu_tvb; if (pdu_len < 1) @@ -2420,7 +2420,7 @@ dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } @@ -2477,7 +2477,7 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data /* * Create display subtree for the protocol */ - ti = proto_tree_add_item (tree, proto_smpp, tvb, 0, tvb_length(tvb), ENC_NA); + ti = proto_tree_add_item (tree, proto_smpp, tvb, 0, tvb_captured_length(tvb), ENC_NA); smpp_tree = proto_item_add_subtree (ti, ett_smpp); /* @@ -2514,13 +2514,13 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data * Physical length: at most command_length * Reported length: command_length */ - if (tvb_length_remaining(tvb, offset - 16 + command_length) > 0) { + if (tvb_captured_length_remaining(tvb, offset - 16 + command_length) > 0) { pdu_tvb = tvb_new_subset(tvb, offset - 16, command_length, /* Physical length */ command_length); /* Length reported by the protocol */ } else { pdu_tvb = tvb_new_subset(tvb, offset - 16, - tvb_length_remaining(tvb, offset - 16),/* Physical length */ + tvb_captured_length_remaining(tvb, offset - 16),/* Physical length */ command_length); /* Length reported by the protocol */ } @@ -2719,7 +2719,7 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data first = FALSE; } - return tvb_length(tvb); + return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index effac96aff..df6c551746 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -2327,7 +2327,7 @@ dissect_control(tvbuff_t *parent_tvb, int offset, int control_len, int len, key; gint ett; - length = tvb_length_remaining(parent_tvb, offset); + length = tvb_captured_length_remaining(parent_tvb, offset); reported_length = tvb_reported_length_remaining(parent_tvb, offset); if (control_len < length) length = control_len; diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c index 378655828d..12faf1e47c 100644 --- a/epan/dissectors/packet-socks.c +++ b/epan/dissectors/packet-socks.c @@ -898,7 +898,7 @@ display_ping_and_tracert(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr proto_tree_add_item(tree, (hash_info->command == PING_COMMAND) ? hf_socks_ping_results : hf_socks_traceroute_results, tvb, offset, -1, ENC_NA); data = tvb_get_ptr(tvb, offset, -1); - dataend = data + tvb_length_remaining(tvb, offset); + dataend = data + tvb_captured_length_remaining(tvb, offset); while (data < dataend) { diff --git a/epan/dissectors/packet-soupbintcp.c b/epan/dissectors/packet-soupbintcp.c index 490d3a1232..a18c270112 100644 --- a/epan/dissectors/packet-soupbintcp.c +++ b/epan/dissectors/packet-soupbintcp.c @@ -472,7 +472,7 @@ dissect_soupbintcp_tcp_pdu( void *data _U_) { dissect_soupbintcp_common(tvb, pinfo, tree); - return tvb_length(tvb); + return tvb_captured_length(tvb); } @@ -488,7 +488,7 @@ dissect_soupbintcp_tcp( soupbintcp_desegment, 2, get_soupbintcp_pdu_len, dissect_soupbintcp_tcp_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static void diff --git a/epan/dissectors/packet-sprt.c b/epan/dissectors/packet-sprt.c index d99b14230a..065990d311 100644 --- a/epan/dissectors/packet-sprt.c +++ b/epan/dissectors/packet-sprt.c @@ -1010,7 +1010,7 @@ dissect_sprt_data(tvbuff_t *tvb, break; } offset += 2; - } while (tvb_length_remaining(tvb, offset) >= 2); + } while (tvb_reported_length_remaining(tvb, offset) >= 2); break; case SPRT_MODEM_RELAY_MSG_ID_START_JM: /* No additional content */ @@ -1464,13 +1464,13 @@ dissect_sprt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_append_fstr(pinfo->cinfo, COL_INFO, ", Seq=%u", seqnum); /* dissect the payload, if any */ - payload_length = tvb_length(tvb) - (6 + noa * 2); /* total sprt length - header stuff */ + payload_length = tvb_captured_length(tvb) - (6 + noa * 2); /* total sprt length - header stuff */ dissect_sprt_data(tvb, pinfo, p_conv_data, sprt_tree, offset, payload_length); if (noa) col_append_str(pinfo->cinfo, COL_INFO, " (ACK fields present)"); - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* heuristic dissector */ @@ -1486,7 +1486,7 @@ dissect_sprt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat * a heuristic dissector called before us! */ - if (tvb_length(tvb) < 6) + if (tvb_captured_length(tvb) < 6) return FALSE; /* packet is waay to short */ /* Get the fields in the first two octets */ diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 8a8fa3097f..8817c2e39a 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -534,7 +534,7 @@ attr_list(proto_tree *tree, packet_info* pinfo, int hf, tvbuff_t *tvb, int offse while (offset+2<length) { offset += 2; /* If the length passed is longer then the actual payload then this must be an incomplete packet. */ - if (tvb_length_remaining(tvb, 4)<length) { + if (tvb_reported_length_remaining(tvb, 4)<length) { proto_tree_add_expert(tree, pinfo, &ei_srvloc_malformed, tvb, offset, -1); break; } @@ -1406,7 +1406,7 @@ dissect_srvloc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da */ tcp_dissect_pdus(tvb, pinfo, tree, srvloc_desegment, 5, get_srvloc_pdu_len, dissect_srvloc, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* Register protocol with Wireshark. */ diff --git a/epan/dissectors/packet-stanag4607.c b/epan/dissectors/packet-stanag4607.c index 7c58abe9d6..8f3af9485a 100644 --- a/epan/dissectors/packet-stanag4607.c +++ b/epan/dissectors/packet-stanag4607.c @@ -832,7 +832,7 @@ dissect_stanag4607(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 seg_id = 0; /* Basic length check */ - if (tvb_length(tvb) < STANAG4607_MIN_LENGTH) + if (tvb_captured_length(tvb) < STANAG4607_MIN_LENGTH) return; col_set_str(pinfo->cinfo, COL_PROTOCOL, "S4607"); diff --git a/epan/dissectors/packet-starteam.c b/epan/dissectors/packet-starteam.c index d41da47f0d..1516bbcd36 100644 --- a/epan/dissectors/packet-starteam.c +++ b/epan/dissectors/packet-starteam.c @@ -497,18 +497,18 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } iPreviousFrameNumber = pinfo->fd->num; - if(tvb_length(tvb) >= 16){ + if(tvb_captured_length(tvb) >= 16){ guint32 iCommand = 0; gboolean bRequest = FALSE; if(tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ /* This packet is a response */ bRequest = FALSE; - col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_length(tvb)); + col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_reported_length(tvb)); - } else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ + } else if(tvb_captured_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ /* This packet is a request */ bRequest = TRUE; - if(tvb_length_remaining(tvb, offset) >= 66){ + if(tvb_captured_length_remaining(tvb, offset) >= 66){ iCommand = tvb_get_letohl(tvb, offset + 62); } col_append_str(pinfo->cinfo, COL_INFO, @@ -526,7 +526,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data starteamroot_tree = proto_item_add_subtree(ti, ett_starteam); if(bRequest){ - if(tvb_length_remaining(tvb, offset) >= 20){ + if(tvb_reported_length_remaining(tvb, offset) >= 20){ starteam_tree = proto_tree_add_subtree(starteamroot_tree, tvb, offset, 20, ett_starteam_mdh, NULL, STARTEAM_TEXT_MDH); proto_tree_add_item(starteam_tree, hf_starteam_mdh_session_tag, tvb, offset + 0, 4, ENC_LITTLE_ENDIAN); @@ -538,7 +538,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } } - if(tvb_length_remaining(tvb, offset) >= 16){ + if(tvb_reported_length_remaining(tvb, offset) >= 16){ starteam_tree = proto_tree_add_subtree(starteamroot_tree, tvb, offset, 16, ett_starteam_ph, NULL, STARTEAM_TEXT_PH); proto_tree_add_item(starteam_tree, hf_starteam_ph_signature, tvb, offset + 0, 4, ENC_ASCII|ENC_NA); @@ -548,7 +548,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data offset += 16; if(bRequest){ - if(tvb_length_remaining(tvb, offset) >= 38){ + if(tvb_reported_length_remaining(tvb, offset) >= 38){ starteam_tree = proto_tree_add_subtree(starteamroot_tree, tvb, offset, 38, ett_starteam_id, NULL, STARTEAM_TEXT_ID); proto_tree_add_item(starteam_tree, hf_starteam_id_revision_level, tvb, offset + 0, 2, ENC_LITTLE_ENDIAN); @@ -561,7 +561,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data offset += 38; } } - if(tvb_length_remaining(tvb, offset) > 0){ + if(tvb_reported_length_remaining(tvb, offset) > 0){ starteam_tree = proto_tree_add_subtree(starteamroot_tree, tvb, offset, -1, ett_starteam_data, NULL, STARTEAM_TEXT_DATA); proto_tree_add_item(starteam_tree, hf_starteam_data_data, tvb, offset, -1, ENC_ASCII|ENC_NA); } @@ -569,7 +569,7 @@ dissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static guint @@ -577,10 +577,10 @@ get_starteam_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) { guint32 iPDULength = 0; - if(tvb_length_remaining(tvb, offset) >= 8 && tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ + if(tvb_captured_length_remaining(tvb, offset) >= 8 && tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ /* Response */ iPDULength = tvb_get_letohl(tvb, offset + 4) + 16; - } else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ + } else if(tvb_captured_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ /* Request */ iPDULength = tvb_get_letohl(tvb, offset + 24) + 36; } @@ -591,14 +591,14 @@ static int dissect_starteam_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, starteam_desegment, 8, get_starteam_pdu_len, dissect_starteam, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static gboolean dissect_starteam_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if(tvb_length(tvb) >= 32){ + if(tvb_captured_length(tvb) >= 32){ gint iOffsetLengths = -1; if(tvb_get_ntohl(tvb, 0) == STARTEAM_MAGIC){ iOffsetLengths = 4; diff --git a/epan/dissectors/packet-sua.c b/epan/dissectors/packet-sua.c index 634e44b558..645cfd504e 100644 --- a/epan/dissectors/packet-sua.c +++ b/epan/dissectors/packet-sua.c @@ -1627,7 +1627,7 @@ dissect_v8_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tr /* extract tag and length from the parameter */ tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET); length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); - padding_length = tvb_length(parameter_tvb) - length; + padding_length = tvb_reported_length(parameter_tvb) - length; /* create proto_tree stuff */ parameter_tree = proto_tree_add_subtree(tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1, ett_sua_parameter, ¶meter_item, val_to_str_const(tag, v8_parameter_tag_values, "Unknown parameter")); @@ -1906,7 +1906,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree /* Extract tag and length from the parameter */ tag = tvb_get_ntohs(parameter_tvb, PARAMETER_TAG_OFFSET); length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); - padding_length = tvb_length(parameter_tvb) - length; + padding_length = tvb_reported_length(parameter_tvb) - length; /* Create proto_tree stuff */ /* If it's a known parameter it's present in the value_string. @@ -2109,7 +2109,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre tvbuff_t *parameter_tvb; offset = 0; - while((remaining_length = tvb_length_remaining(parameters_tvb, offset))) { + while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) { length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET); total_length = ADD_PADDING(length); if (remaining_length >= length) diff --git a/epan/dissectors/packet-sync.c b/epan/dissectors/packet-sync.c index 9dbd31447b..6f346903eb 100644 --- a/epan/dissectors/packet-sync.c +++ b/epan/dissectors/packet-sync.c @@ -87,11 +87,11 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ if ( type > 3 ) return 0; - if ( type == 0 && tvb_length(tvb) < 18) { + if ( type == 0 && tvb_captured_length(tvb) < 18) { return 0; - } else if ( type == 1 && tvb_length(tvb) < 11 ) { + } else if ( type == 1 && tvb_captured_length(tvb) < 11 ) { return 0; - } else if ( type == 3 && tvb_length(tvb) < 19 ) { + } else if ( type == 3 && tvb_captured_length(tvb) < 19 ) { return 0; } @@ -219,7 +219,7 @@ dissect_sync(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ break; } - return tvb_length(tvb); + return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-synergy.c b/epan/dissectors/packet-synergy.c index 76bd1268e8..b8425e00c8 100644 --- a/epan/dissectors/packet-synergy.c +++ b/epan/dissectors/packet-synergy.c @@ -218,7 +218,7 @@ static void dissect_synergy_handshake( tvbuff_t *tvb, packet_info *pinfo _U_, pr proto_tree_add_item(sub_tree, hf_synergy_handshake_majorversion, tvb, offset + 7, 2, ENC_BIG_ENDIAN); proto_tree_add_item(sub_tree, hf_synergy_handshake_minorversion, tvb, offset + 9, 2, ENC_BIG_ENDIAN); - if (tvb_length_remaining(tvb, offset + 11) != 0) + if (tvb_reported_length_remaining(tvb, offset + 11) != 0) { proto_tree_add_item(sub_tree, hf_synergy_unknown, tvb, offset + 11, 4, ENC_NA); proto_tree_add_item(sub_tree, hf_synergy_handshake_clientname, tvb, offset + 15, -1, ENC_ASCII|ENC_NA); @@ -259,7 +259,7 @@ static void dissect_synergy_dkdn( tvbuff_t *tvb, packet_info *pinfo _U_, proto_t proto_tree_add_item(sub_tree, hf_synergy_dkdn_keyid, tvb, offset + 4, 2, ENC_BIG_ENDIAN); proto_tree_add_item(sub_tree, hf_synergy_dkdn_keymodifiermask, tvb, offset + 6, 2, ENC_BIG_ENDIAN); - if (tvb_length_remaining(tvb, offset + 8) != 0) + if (tvb_reported_length_remaining(tvb, offset + 8) != 0) proto_tree_add_item(sub_tree, hf_synergy_dkdn_keybutton, tvb, offset + 8, 2, ENC_BIG_ENDIAN); } @@ -274,7 +274,7 @@ static void dissect_synergy_dkrp( tvbuff_t *tvb, packet_info *pinfo _U_, proto_t proto_tree_add_item(sub_tree, hf_synergy_dkrp_keymodifiermask, tvb, offset + 6, 2, ENC_BIG_ENDIAN); proto_tree_add_item(sub_tree, hf_synergy_dkrp_numberofrepeats, tvb, offset + 8, 2, ENC_BIG_ENDIAN); - if (tvb_length_remaining(tvb, offset + 10) != 0) + if (tvb_reported_length_remaining(tvb, offset + 10) != 0) proto_tree_add_item(sub_tree, hf_synergy_dkrp_keybutton, tvb, offset + 10, 2, ENC_BIG_ENDIAN); } @@ -288,7 +288,7 @@ static void dissect_synergy_dkup( tvbuff_t *tvb, packet_info *pinfo _U_, proto_t proto_tree_add_item(sub_tree, hf_synergy_dkup_keyid, tvb, offset + 4, 2, ENC_BIG_ENDIAN); proto_tree_add_item(sub_tree, hf_synergy_dkup_keymodifiermask, tvb, offset + 6, 2, ENC_BIG_ENDIAN); - if (tvb_length_remaining(tvb, offset + 8) != 0) + if (tvb_reported_length_remaining(tvb, offset + 8) != 0) proto_tree_add_item(sub_tree, hf_synergy_dkup_keybutton, tvb, offset + 8, 2, ENC_BIG_ENDIAN); } diff --git a/epan/dissectors/packet-t30.c b/epan/dissectors/packet-t30.c index aae0eefb9c..8db14d7df1 100644 --- a/epan/dissectors/packet-t30.c +++ b/epan/dissectors/packet-t30.c @@ -958,7 +958,7 @@ dissect_t30_hdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data tr_fif = proto_item_add_subtree(it_fcf, ett_t30_fif); - frag_len = tvb_length_remaining(tvb, offset); + frag_len = tvb_reported_length_remaining(tvb, offset); if (t38) t38->t30_Facsimile_Control = octet; diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index 59f830c437..cdd191b35e 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -891,7 +891,7 @@ dissect_tacplus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) len = tvb_get_ntohl(tvb, 8); - if(len > (guint)tvb_length_remaining(tvb, 12) && + if(len > (guint)tvb_captured_length_remaining(tvb, 12) && pinfo->can_desegment && tacplus_preference_desegment) { pinfo->desegment_offset = 0; pinfo->desegment_len = len; diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c index 8371e940f0..4918e3548d 100644 --- a/epan/dissectors/packet-tali.c +++ b/epan/dissectors/packet-tali.c @@ -132,7 +132,7 @@ dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -140,7 +140,7 @@ dissect_tali(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, tali_desegment, TALI_HEADER_LENGTH, get_tali_pdu_len, dissect_tali_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* diff --git a/epan/dissectors/packet-tapa.c b/epan/dissectors/packet-tapa.c index 2a897f0d6d..3d78e1d707 100644 --- a/epan/dissectors/packet-tapa.c +++ b/epan/dissectors/packet-tapa.c @@ -417,7 +417,7 @@ test_tapa_discover(tvbuff_t *tvb) guint8 type, req_type; guint16 length; - if (tvb_length(tvb) < 4) + if (tvb_captured_length(tvb) < 4) return FALSE; /* Type(1 byte) <= 5, unknown(1 byte), length(2 bytes) */ @@ -442,7 +442,7 @@ test_tapa_tunnel(tvbuff_t *tvb) { /* If it isn't IPv4, it's TAPA. IPv4: Version(1 byte) = 4, length(2 bytes) >= 20 */ - if (tvb_length(tvb) < 4 || + if (tvb_captured_length(tvb) < 4 || (tvb_get_guint8(tvb, 0) & 0xF0) >= 0x40 || tvb_get_ntohs(tvb, 2) > 0 || tvb_get_guint8(tvb, 1) > 1) { /* Is tunnel type known? */ diff --git a/epan/dissectors/packet-tdmoe.c b/epan/dissectors/packet-tdmoe.c index 9e9ebe57ba..fab25cc0a5 100644 --- a/epan/dissectors/packet-tdmoe.c +++ b/epan/dissectors/packet-tdmoe.c @@ -67,7 +67,7 @@ dissect_tdmoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U int chan; /* Check that there's enough data */ - if (tvb_length(tvb) < 8) + if (tvb_captured_length(tvb) < 8) return 0; subaddress = tvb_get_ntohs(tvb, 0); diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index ac0234b74a..47090753b7 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -1422,7 +1422,7 @@ netlib_check_login_pkt(tvbuff_t *tvb, guint offset, packet_info *pinfo, guint8 t { guint tds_major, bytes_avail; - bytes_avail = tvb_length(tvb) - offset; + bytes_avail = tvb_captured_length(tvb) - offset; /* * we have two login packet styles, one for TDS 4.2 and 5.0 */ @@ -2115,7 +2115,7 @@ dissect_tds_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tree = proto_item_add_subtree(item, ett_tds_message); dissect_tds_all_headers(tvb, &offset, pinfo, tree); - while(tvb_length_remaining(tvb, offset) > 0) { + while(tvb_reported_length_remaining(tvb, offset) > 0) { /* * RPC name. */ @@ -2154,7 +2154,7 @@ dissect_tds_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 2; /* dissect parameters */ - while(tvb_length_remaining(tvb, offset) > 0) { + while(tvb_reported_length_remaining(tvb, offset) > 0) { gboolean plp; len = tvb_get_guint8(tvb, offset); @@ -2596,7 +2596,7 @@ dissect_tds_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * * If we don't have even enough data for a Netlib header, * just say it's not TDS. */ - if (tvb_length(tvb) < 8) + if (tvb_captured_length(tvb) < 8) return FALSE; /* diff --git a/epan/dissectors/packet-teamspeak2.c b/epan/dissectors/packet-teamspeak2.c index ab738bcdcf..44e7941f65 100644 --- a/epan/dissectors/packet-teamspeak2.c +++ b/epan/dissectors/packet-teamspeak2.c @@ -430,7 +430,7 @@ static void ts2_standard_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree * frag_msg = NULL; pinfo->fragmented = TRUE; fragment_number = tvb_get_letohs(tvb, 18); - frag_msg = fragment_add_seq_check(&msg_reassembly_table, tvb, 24, pinfo, type, NULL, frag->frag_num, tvb_length_remaining(tvb, 24), fragment_number); + frag_msg = fragment_add_seq_check(&msg_reassembly_table, tvb, 24, pinfo, type, NULL, frag->frag_num, tvb_captured_length_remaining(tvb, 24), fragment_number); new_tvb = process_reassembled_data(tvb, 24, pinfo,"Reassembled TeamSpeak2", frag_msg, &msg_frag_items, NULL, ts2_tree); if (frag_msg) /* XXX: should be if (new_tvb) ?? */ { /* Reassembled */ @@ -514,7 +514,7 @@ static void ts2_parse_loginend(tvbuff_t *tvb, proto_tree *ts2_tree) { gint32 offset; offset=0; - proto_tree_add_item(ts2_tree, hf_ts2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); + proto_tree_add_item(ts2_tree, hf_ts2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); } /* Parses a ts2 known player joined (TS2_KNOWNPLAYERUPDATE) packet and adds it to the tree */ @@ -574,7 +574,7 @@ static void ts2_parse_playerleft(tvbuff_t *tvb, proto_tree *ts2_tree) offset+=4; proto_tree_add_item(ts2_tree, hf_ts2_unknown, tvb, offset, 4, ENC_NA); offset+=4; - proto_tree_add_item(ts2_tree, hf_ts2_unknown, tvb, offset, tvb_length_remaining(tvb, offset), ENC_NA); + proto_tree_add_item(ts2_tree, hf_ts2_unknown, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA); } /* Parses a ts2 login part 2 (TS2T_LOGINPART2) packet and adds it to the tree */ @@ -604,7 +604,7 @@ static void ts2_parse_channellist(tvbuff_t *tvb, proto_tree *ts2_tree) offset=0; proto_tree_add_item(ts2_tree, hf_ts2_number_of_channels, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset+=4; - while(offset<tvb_length_remaining(tvb, 0)) + while(offset<tvb_reported_length_remaining(tvb, 0)) { proto_tree_add_item(ts2_tree, hf_ts2_channel_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset+=4; @@ -662,7 +662,7 @@ static void ts2_parse_playerlist(tvbuff_t *tvb, proto_tree *ts2_tree) proto_tree_add_item(ts2_tree, hf_ts2_number_of_players, tvb, offset, 4, ENC_LITTLE_ENDIAN); number_of_players = tvb_get_letohl(tvb, 0); offset+=4; - while(offset<tvb_length_remaining(tvb, 0) && x<number_of_players) + while(offset<tvb_reported_length_remaining(tvb, 0) && x<number_of_players) { proto_tree_add_item(ts2_tree, hf_ts2_player_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset+=4; @@ -677,7 +677,7 @@ static void ts2_parse_playerlist(tvbuff_t *tvb, proto_tree *ts2_tree) offset+=30; x++; } - proto_tree_add_item(ts2_tree, hf_ts2_emptyspace, tvb, offset, tvb_length_remaining(tvb, 0), ENC_NA); + proto_tree_add_item(ts2_tree, hf_ts2_emptyspace, tvb, offset, tvb_captured_length_remaining(tvb, 0), ENC_NA); } diff --git a/epan/dissectors/packet-teredo.c b/epan/dissectors/packet-teredo.c index 53d7bdb6d8..af5fe670ff 100644 --- a/epan/dissectors/packet-teredo.c +++ b/epan/dissectors/packet-teredo.c @@ -260,7 +260,7 @@ dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d if (!global_teredo_heur) return FALSE; - if (tvb_length_remaining(tvb, offset) < 40) + if (tvb_captured_length_remaining(tvb, offset) < 40) return FALSE; val = tvb_get_ntohs(tvb, offset); @@ -277,7 +277,7 @@ dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d aulen = tvb_get_guint8(tvb, offset); offset += 10; - if (tvb_length_remaining(tvb, offset) < idlen + aulen + 40) + if (tvb_captured_length_remaining(tvb, offset) < idlen + aulen + 40) return FALSE; offset += idlen + aulen; @@ -289,7 +289,7 @@ dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d { offset += 8; - if (tvb_length_remaining(tvb, offset) < 40) + if (tvb_captured_length_remaining(tvb, offset) < 40) return FALSE; val = tvb_get_ntohs(tvb, offset); @@ -311,7 +311,7 @@ dissect_teredo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d if (val > 65467) return FALSE; /* length too big for Teredo */ - if (tvb_length_remaining(tvb, offset) != val) + if (tvb_reported_length_remaining(tvb, offset) != val) return FALSE; /* length mismatch */ dissect_teredo (tvb, pinfo, tree); diff --git a/epan/dissectors/packet-text-media.c b/epan/dissectors/packet-text-media.c index c3aa7ee9ec..bba17354fa 100644 --- a/epan/dissectors/packet-text-media.c +++ b/epan/dissectors/packet-text-media.c @@ -60,7 +60,7 @@ dissect_text_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da gint offset = 0, next_offset; gint len; const char *data_name; - int length = tvb_length(tvb); + int length = tvb_captured_length(tvb); /* Check if this is actually xml * If there is less than 38 characters this is not XML diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c index 1fbda23c42..19306adead 100644 --- a/epan/dissectors/packet-tipc.c +++ b/epan/dissectors/packet-tipc.c @@ -1077,7 +1077,7 @@ dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_i offset += padlen; }; if ((offset-msg_size) > 0) { - proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "Filler for MTU discovery: %d byte%c", tvb_length_remaining(tipc_tvb, offset), (padlen!=1?'s':0)); + proto_tree_add_text(tipc_tree, tipc_tvb, offset, -1, "Filler for MTU discovery: %d byte%c", tvb_reported_length_remaining(tipc_tvb, offset), (padlen!=1?'s':0)); }; break; case TIPCv2_CONN_MANAGER: @@ -1969,7 +1969,7 @@ dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tr pinfo, link_sel, /* ID for fragments belonging together - NEEDS IMPROVING? */ NULL, - tvb_length_remaining(tvb, offset), /* fragment length - to the end */ + tvb_captured_length_remaining(tvb, offset), /* fragment length - to the end */ TRUE); /* More fragments? */ if (msg_type == TIPC_FIRST_SEGMENT) { reassembled_msg_length = tvb_get_ntohl(tvb, offset) & 0x1ffff; @@ -2048,7 +2048,7 @@ dissect_tipc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi { tcp_dissect_pdus(tvb, pinfo, parent_tree, tipc_tcp_desegment, 4, get_tipc_pdu_len, dissect_tipc, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -2079,7 +2079,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ user = (dword>>25) & 0xf; msg_size = dword & 0x1ffff; - if ((guint32)tvb_length_remaining(tvb, offset) < msg_size) { + if ((guint32)tvb_reported_length_remaining(tvb, offset) < msg_size) { tipc_tvb = tvb; } else { tipc_tvb = tvb_new_subset_length(tvb, offset, msg_size); @@ -2167,7 +2167,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ tipc_tree = proto_item_add_subtree(ti, ett_tipc); if (version == TIPCv2) { dissect_tipc_v2(tipc_tvb, tipc_tree, pinfo, offset, user, msg_size, hdr_size, datatype_hdr); - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* Word 0-2 common for all messages */ @@ -2204,7 +2204,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ case TIPC_SEGMENTATION_MANAGER: case TIPC_MSG_BUNDLER: dissect_tipc_int_prot_msg(tipc_tvb, pinfo, tipc_tree, offset, user, msg_size); - return tvb_length(tvb); + return tvb_captured_length(tvb); default: break; } @@ -2282,7 +2282,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ "TIPC_NAME_DISTRIBUTOR %u bytes User Data", (msg_size - hdr_size*4)); data_tvb = tvb_new_subset_remaining(tipc_tvb, offset); dissect_tipc_name_dist_data(data_tvb, tipc_data_tree, 0); - return tvb_length(tvb); + return tvb_captured_length(tvb); } else { /* Port name type / Connection level sequence number */ proto_tree_add_text(tipc_tree, tipc_tvb, offset, 4, "Port name type / Connection level sequence number"); @@ -2319,7 +2319,7 @@ dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } } /*if (hdr_size <= 5) */ - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* Register TIPC with Wireshark */ diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index 345c3541ab..79bfeac866 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -67,7 +67,7 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea return 0; } - length = tvb_length(tvb); + length = tvb_captured_length(tvb); string = (gchar*)tvb_get_string_enc(wmem_packet_scope(), tvb, 0, length, ENC_ASCII); /* Make entries in Protocol column and Info column on summary display */ diff --git a/epan/dissectors/packet-tns.c b/epan/dissectors/packet-tns.c index 530b7f1b04..ee4c7ff2b3 100644 --- a/epan/dissectors/packet-tns.c +++ b/epan/dissectors/packet-tns.c @@ -776,7 +776,7 @@ dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) tcp_dissect_pdus(tvb, pinfo, tree, tns_desegment, 2, get_tns_pdu_len, dissect_tns_pdu, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -887,7 +887,7 @@ dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data break; } - return tvb_length(tvb); + return tvb_captured_length(tvb); } void proto_register_tns(void) diff --git a/epan/dissectors/packet-tpkt.c b/epan/dissectors/packet-tpkt.c index feac15b7b2..cbb5e920d3 100644 --- a/epan/dissectors/packet-tpkt.c +++ b/epan/dissectors/packet-tpkt.c @@ -80,7 +80,7 @@ is_tpkt(tvbuff_t *tvb, int min_len) return -1; /* There should at least be 4 bytes left in the frame */ - if (tvb_length(tvb) < 4) + if (tvb_captured_length(tvb) < 4) return -1; /* there aren't */ /* @@ -255,7 +255,7 @@ dissect_asciitpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return; } - length_remaining = tvb_length_remaining(tvb, offset); + length_remaining = tvb_captured_length_remaining(tvb, offset); /* * Get the length from the TPKT header. @@ -401,7 +401,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return; } - length_remaining = tvb_length_remaining(tvb, offset); + length_remaining = tvb_captured_length_remaining(tvb, offset); /* * Can we do reassembly? diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c index 50bcb55b27..a63343b1ae 100644 --- a/epan/dissectors/packet-turnchannel.c +++ b/epan/dissectors/packet-turnchannel.c @@ -66,7 +66,7 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *turnchannel_tree; heur_dtbl_entry_t *hdtbl_entry; - len = tvb_length(tvb); + len = tvb_captured_length(tvb); /* First, make sure we have enough data to do the check. */ if (len < TURNCHANNEL_HDR_LEN) { return 0; @@ -100,7 +100,7 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo, tvbuff_t *next_tvb; guint reported_len, new_len; - new_len = tvb_length_remaining(tvb, TURNCHANNEL_HDR_LEN); + new_len = tvb_captured_length_remaining(tvb, TURNCHANNEL_HDR_LEN); reported_len = tvb_reported_length_remaining(tvb, TURNCHANNEL_HDR_LEN); if (data_len < reported_len) { @@ -116,7 +116,7 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo, } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } static guint @@ -131,7 +131,7 @@ dissect_turnchannel_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi { tcp_dissect_pdus(tvb, pinfo, tree, TRUE, TURNCHANNEL_HDR_LEN, get_turnchannel_message_len, dissect_turnchannel_message, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } @@ -142,7 +142,7 @@ dissect_turnchannel_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo guint16 channel_id; guint16 data_len; - len = tvb_length(tvb); + len = tvb_captured_length(tvb); /* First, make sure we have enough data to do the check. */ if (len < TURNCHANNEL_HDR_LEN) { return FALSE; diff --git a/epan/dissectors/packet-tuxedo.c b/epan/dissectors/packet-tuxedo.c index ba7bcf2f15..610e3ffae9 100644 --- a/epan/dissectors/packet-tuxedo.c +++ b/epan/dissectors/packet-tuxedo.c @@ -108,7 +108,7 @@ dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "TUXEDO"); - if (tvb_length(tvb) >= 8) + if (tvb_reported_length(tvb) >= 8) { magic = tvb_get_ntohl(tvb, 0); if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC) @@ -141,7 +141,7 @@ dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static gboolean dissect_tuxedo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - if (tvb_length(tvb) >= 8) + if (tvb_captured_length(tvb) >= 8) { guint32 magic; magic = tvb_get_ntohl(tvb, 0); diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c index 014cd38477..1cc09a286d 100644 --- a/epan/dissectors/packet-ua3g.c +++ b/epan/dissectors/packet-ua3g.c @@ -4049,7 +4049,7 @@ dissect_ua3g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) } } - return tvb_length(tvb); + return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c index b099573f87..514f282be9 100644 --- a/epan/dissectors/packet-uasip.c +++ b/epan/dissectors/packet-uasip.c @@ -209,7 +209,7 @@ static void _dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ua_tap_info.expseq = tvb_get_ntohs(tvb, offset+0); ua_tap_info.sntseq = tvb_get_ntohs(tvb, offset+2); offset += 4; - datalen = (tvb_length(tvb) - offset); + datalen = (tvb_reported_length(tvb) - offset); if (noesip_enabled) { diff --git a/epan/dissectors/packet-ubertooth.c b/epan/dissectors/packet-ubertooth.c index c12f1d0670..847ed81e77 100644 --- a/epan/dissectors/packet-ubertooth.c +++ b/epan/dissectors/packet-ubertooth.c @@ -1651,7 +1651,7 @@ dissect_ubertooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat if (tvb_length_remaining(tvb, offset) > 0) { proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, tvb_length_remaining(tvb, offset)); - offset = tvb_length(tvb); + offset = tvb_captured_length(tvb); } /* Save request info (command_data) */ diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c index 8a67390ebd..fe97d55be6 100644 --- a/epan/dissectors/packet-ucp.c +++ b/epan/dissectors/packet-ucp.c @@ -1778,7 +1778,7 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da if (tvb_get_guint8(tvb, 0) != UCP_STX){ proto_tree_add_expert(tree, pinfo, &ei_ucp_stx_missing, tvb, 0, -1); - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* Get data needed for dissect_ucp_common */ @@ -1946,7 +1946,7 @@ dissect_ucp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da /* Queue packet for Tap */ tap_queue_packet(ucp_tap, pinfo, tap_rec); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static int @@ -1954,7 +1954,7 @@ dissect_ucp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, ucp_desegment, UCP_HEADER_SIZE, get_ucp_pdu_len, dissect_ucp_common, data); - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* @@ -1968,7 +1968,7 @@ dissect_ucp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data /* Heuristic */ - if (tvb_length(tvb) < UCP_HEADER_SIZE) + if (tvb_captured_length(tvb) < UCP_HEADER_SIZE) return FALSE; if ((tvb_get_guint8(tvb, 0) != UCP_STX) || diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 641f186487..58d54fa74d 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -619,11 +619,11 @@ static gboolean verify_control_frame_crc(tvbuff_t * tvb, packet_info * pinfo, pr guint8 crc = 0; guint8 * data = NULL; /* Get data. */ - data = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 0, tvb_length(tvb)); + data = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 0, tvb_reported_length(tvb)); /* Include only FT flag bit in CRC calculation. */ data[0] = data[0] & 1; /* Calculate crc7 sum. */ - crc = crc7update(0, data, tvb_length(tvb)); + crc = crc7update(0, data, tvb_reported_length(tvb)); crc = crc7finalize(crc); /* finalize crc */ if (frame_crc == crc) { proto_item_append_text(pi, " [correct]"); @@ -3782,7 +3782,7 @@ heur_dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data * i.e. from bit 0 of the first byte of the header (the FT IE) to bit 0 of the last byte of the payload, * with the corresponding generator polynomial: G(D) = D7+D6+D2+1. See subclause 7.2. */ - length = tvb_length(tvb); + length = tvb_reported_length(tvb); buf = (unsigned char *)tvb_memdup(wmem_packet_scope(), tvb, 0, length); buf[0] = 01; diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index 42f8695776..d9b4afc534 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -468,7 +468,7 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * PROTO_ITEM_SET_GENERATED(channel_type); /*We need to skip the first two bits (the TCTF bits), and since there is no MAC header, send rest to RRC*/ - next_tvb= tvb_new_octet_aligned(tvb, 2, (tvb_length(tvb)*8)-2); + next_tvb= tvb_new_octet_aligned(tvb, 2, (tvb_reported_length(tvb)*8)-2); add_new_data_source(pinfo, next_tvb, "Octet-Aligned BCCH Data"); /* In this case skip RLC and call RRC immediately subdissector */ diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c index 93ff1d932d..ff1b221106 100644 --- a/epan/dissectors/packet-usb-ccid.c +++ b/epan/dissectors/packet-usb-ccid.c @@ -554,7 +554,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) } /* TODO: Try use "offset" instead of hardcoded constants */ - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-usb-dfu.c b/epan/dissectors/packet-usb-dfu.c index 73caf3b702..39e0930a2d 100644 --- a/epan/dissectors/packet-usb-dfu.c +++ b/epan/dissectors/packet-usb-dfu.c @@ -288,12 +288,12 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) if (command == 0x01) { /* Download */ proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA); - offset = tvb_length(tvb); + 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)); - offset = tvb_length(tvb); + offset = tvb_captured_length(tvb); } /* Save request info (command_data) */ @@ -340,7 +340,7 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) pinfo->p2p_dir = p2p_dir_save; - return tvb_length(tvb); + return tvb_captured_length(tvb); } col_append_fstr(pinfo->cinfo, COL_INFO, "Response: %s", @@ -367,7 +367,7 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) } proto_tree_add_item(main_tree, hf_data, tvb, offset, -1, ENC_NA); - offset = tvb_length(tvb); + offset = tvb_captured_length(tvb); break; case 0x03: /* Get Status */ @@ -406,7 +406,7 @@ dissect_usb_dfu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_expert(command_tree, pinfo, &ei_unexpected_response, tvb, offset, 0); if (tvb_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); } } diff --git a/epan/dissectors/packet-usb-hub.c b/epan/dissectors/packet-usb-hub.c index 7098d83c5f..ce6edb3605 100644 --- a/epan/dissectors/packet-usb-hub.c +++ b/epan/dissectors/packet-usb-hub.c @@ -605,7 +605,7 @@ static const usb_setup_dissector_table_t setup_dissectors[] = { /* Dissector for USB HUB class-specific control request as defined in * USB 2.0, Chapter 11.24.2 Class-specific Requests - * Returns tvb_length(tvb) if a class specific dissector was found + * Returns tvb_captured_length(tvb) if a class specific dissector was found * and 0 otherwise. */ static gint @@ -656,7 +656,7 @@ dissect_usb_hub_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi } dissector(pinfo, tree, tvb, offset, is_request, usb_trans_info, usb_conv_info); - return tvb_length(tvb); + return tvb_captured_length(tvb); } void diff --git a/epan/dissectors/packet-usb-masstorage.c b/epan/dissectors/packet-usb-masstorage.c index 815707035d..3563c5b535 100644 --- a/epan/dissectors/packet-usb-masstorage.c +++ b/epan/dissectors/packet-usb-masstorage.c @@ -122,7 +122,7 @@ static const value_string setup_request_names_vals[] = { }; /* Dissector for mass storage control . - * Returns tvb_length(tvb) if a class specific dissector was found + * Returns tvb_captured_length(tvb) if a class specific dissector was found * and 0 othervise. */ static gint @@ -169,7 +169,7 @@ dissect_usb_ms_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void } dissector(pinfo, tree, tvb, offset, is_request, usb_trans_info, usb_conv_info); - return tvb_length(tvb); + return tvb_captured_length(tvb); } @@ -218,7 +218,7 @@ dissect_usb_ms_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* * SCSI CDB inside CBW */ - if(is_request&&(signature==0x43425355)&&(tvb_length(tvb)==31)){ + if(is_request&&(signature==0x43425355)&&(tvb_reported_length(tvb)==31)){ tvbuff_t *cdb_tvb; int cdbrlen, cdblen; guint8 lun, flags; @@ -288,21 +288,21 @@ dissect_usb_ms_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, offset+=1; cdblen=cdbrlen; - if(cdblen>tvb_length_remaining(tvb, offset)){ - cdblen=tvb_length_remaining(tvb, offset); + if(cdblen>tvb_captured_length_remaining(tvb, offset)){ + cdblen=tvb_captured_length_remaining(tvb, offset); } if(cdblen){ cdb_tvb=tvb_new_subset(tvb, offset, cdblen, cdbrlen); dissect_scsi_cdb(cdb_tvb, pinfo, parent_tree, SCSI_DEV_UNKNOWN, itlq, itl); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* * SCSI RESPONSE inside CSW */ - if((!is_request)&&(signature==0x53425355)&&(tvb_length(tvb)==13)){ + if((!is_request)&&(signature==0x53425355)&&(tvb_reported_length(tvb)==13)){ guint8 status; /* dCSWSignature */ @@ -324,13 +324,13 @@ dissect_usb_ms_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, itlq=(itlq_nexus_t *)wmem_tree_lookup32_le(usb_ms_conv_info->itlq, pinfo->fd->num); if(!itlq){ - return tvb_length(tvb); + return tvb_captured_length(tvb); } itlq->last_exchange_frame=pinfo->fd->num; itl=(itl_nexus_t *)wmem_tree_lookup32(usb_ms_conv_info->itl, itlq->lun); if(!itl){ - return tvb_length(tvb); + return tvb_captured_length(tvb); } if(!status){ @@ -339,7 +339,7 @@ dissect_usb_ms_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, /* just send "check condition" */ dissect_scsi_rsp(tvb, pinfo, parent_tree, itlq, itl, 0x02); } - return tvb_length(tvb); + return tvb_captured_length(tvb); } /* @@ -347,16 +347,16 @@ dissect_usb_ms_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, */ itlq=(itlq_nexus_t *)wmem_tree_lookup32_le(usb_ms_conv_info->itlq, pinfo->fd->num); if(!itlq){ - return tvb_length(tvb); + return tvb_captured_length(tvb); } itl=(itl_nexus_t *)wmem_tree_lookup32(usb_ms_conv_info->itl, itlq->lun); if(!itl){ - return tvb_length(tvb); + return tvb_captured_length(tvb); } dissect_scsi_payload(tvb, pinfo, parent_tree, is_request, itlq, itl, 0); - return tvb_length(tvb); + return tvb_captured_length(tvb); } static gboolean diff --git a/epan/dissectors/packet-usb-video.c b/epan/dissectors/packet-usb-video.c index 3d2d7b8595..3de3926cbe 100644 --- a/epan/dissectors/packet-usb-video.c +++ b/epan/dissectors/packet-usb-video.c @@ -1472,7 +1472,7 @@ dissect_usb_vid_descriptor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, descriptor_len = tvb_get_guint8(tvb, offset); descriptor_type = tvb_get_guint8(tvb, offset+1); - bytes_available = tvb_length_remaining(tvb, offset); + bytes_available = tvb_captured_length_remaining(tvb, offset); desc_tvb = tvb_new_subset(tvb, 0, bytes_available, descriptor_len); if (descriptor_type == CS_ENDPOINT) @@ -1547,7 +1547,7 @@ dissect_usb_vid_probe(proto_tree *parent_tree, tvbuff_t *tvb, int offset) offset += 26; /* UVC 1.1 fields */ - if (tvb_length_remaining(tvb, offset) > 0) + if (tvb_reported_length_remaining(tvb, offset) > 0) { static const int *framing_bits[] = { &hf_usb_vid_probe_framing_D[0], @@ -2044,7 +2044,7 @@ dissect_usb_vid_interrupt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v int offset = 0; usb_conv_info = (usb_conv_info_t *)data; - bytes_available = tvb_length_remaining(tvb, offset); + bytes_available = tvb_reported_length_remaining(tvb, offset); col_set_str(pinfo->cinfo, COL_PROTOCOL, "USBVIDEO"); diff --git a/epan/dissectors/packet-uts.c b/epan/dissectors/packet-uts.c index 78c715541d..468ca975eb 100644 --- a/epan/dissectors/packet-uts.c +++ b/epan/dissectors/packet-uts.c @@ -73,7 +73,7 @@ static int testchar(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, int op, g { gchar temp; - if (tvb_length_remaining(tvb, offset)) { + if (tvb_bytes_exist(tvb, offset, 1)) { temp = tvb_get_guint8(tvb, offset) & 0x7f; if (op == FETCH || (op == MATCH && temp == match)) { if (storage != NULL) @@ -236,7 +236,7 @@ dissect_uts(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) } } - while (tvb_length_remaining(tvb, offset) > 0) { /* now look for the ETX */ + while (tvb_reported_length_remaining(tvb, offset) > 0) { /* now look for the ETX */ if ((tvb_get_guint8(tvb, offset) & 0x7f) == ETX) { if (header_length == -1) header_length = offset; /* the header ends at an STX, or if not found, the ETX */ @@ -246,7 +246,7 @@ dissect_uts(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) } offset++; } - if (tvb_length_remaining(tvb, offset)) /* if there is anything left, it could be the BCC and pads */ + if (tvb_reported_length_remaining(tvb, offset)) /* if there is anything left, it could be the BCC and pads */ bcc_start = offset; if (tree) { @@ -297,7 +297,7 @@ dissect_uts(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) if (stx_start) { proto_tree_add_protocol_format(uts_header_tree, proto_uts, tvb, stx_start, 1, "Start of Text"); - length = tvb_length_remaining(tvb, stx_start+1); /* find out how much message remains */ + length = tvb_captured_length_remaining(tvb, stx_start+1); /* find out how much message remains */ if (etx_start) length = (etx_start - stx_start - 1); /* and the data part is the rest... */ /* whatever preceeds the ETX if it exists */ |