diff --git a/epan/dissectors/packet-carp.c b/epan/dissectors/packet-carp.c index 8975ad2a0a..8c9511370b 100644 --- a/epan/dissectors/packet-carp.c +++ b/epan/dissectors/packet-carp.c @@ -63,7 +63,7 @@ test_carp_packet(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, vo /* First some simple check if the data is really CARP */ - if (tvb_length(tvb) < 36) + if (tvb_captured_length(tvb) < 36) return FALSE; /* Version must be 1 or 2, type must be in carp_type_vals */ @@ -136,7 +136,7 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) cksum = tvb_get_ntohs(tvb, offset); ti = proto_tree_add_item(carp_tree, hf_carp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN); carp_len = tvb_reported_length(tvb); - if (!pinfo->fragmented && tvb_length(tvb) >= carp_len) { + if (!pinfo->fragmented && tvb_captured_length(tvb) >= carp_len) { /* The packet isn't part of a fragmented datagram and isn't truncated, so we can checksum it. */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, carp_len); diff --git a/epan/dissectors/packet-cast.c b/epan/dissectors/packet-cast.c index 72065047ac..ae51e95ea8 100644 --- a/epan/dissectors/packet-cast.c +++ b/epan/dissectors/packet-cast.c @@ -996,7 +996,7 @@ dissect_cast_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } } - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* Get the length of a single CAST PDU */ @@ -1034,7 +1034,7 @@ dissect_cast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) hdr_data_length = tvb_get_letohl(tvb, 0); hdr_marker = tvb_get_letohl(tvb, 4); - /* data_size = MIN(8+hdr_data_length, tvb_length(tvb)) - 0xC; */ + /* data_size = MIN(8+hdr_data_length, tvb_reported_length(tvb)) - 0xC; */ if (hdr_data_length < 4 || hdr_marker != 0) { return 0; @@ -1045,7 +1045,7 @@ dissect_cast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) col_set_str(pinfo->cinfo, COL_INFO, "Cast Client Control Protocol"); tcp_dissect_pdus(tvb, pinfo, tree, cast_desegment, 4, get_cast_pdu_len, dissect_cast_pdu, data); - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* Register the protocol with Wireshark */ diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c index bafe50587d..d1a6b577f9 100644 --- a/epan/dissectors/packet-catapult-dct2000.c +++ b/epan/dissectors/packet-catapult-dct2000.c @@ -351,7 +351,7 @@ static gboolean find_ipprim_data_offset(tvbuff_t *tvb, int *data_offset, guint8 } /* Skip any other TLC fields before reach payload */ - while (tvb_length_remaining(tvb, offset) > 2) { + while (tvb_reported_length_remaining(tvb, offset) > 2) { /* Look at next tag */ tag = tvb_get_guint8(tvb, offset++); @@ -458,7 +458,7 @@ static gboolean find_sctpprim_variant1_data_offset(tvbuff_t *tvb, int *data_offs offset += skipASNLength(first_length_byte); /* Skip any other fields before reach payload */ - while (tvb_length_remaining(tvb, offset) > 2) { + while (tvb_reported_length_remaining(tvb, offset) > 2) { /* Look at next tag */ tag = tvb_get_guint8(tvb, offset++); @@ -613,7 +613,7 @@ static gboolean find_sctpprim_variant3_data_offset(tvbuff_t *tvb, int *data_offs offset += 2; /* Some optional params */ - while ((tag != 0x0c00) && (tvb_length_remaining(tvb, offset) > 4)) { + while ((tag != 0x0c00) && (tvb_reported_length_remaining(tvb, offset) > 4)) { switch (tag) { case 0x0900: /* Dest address */ /* Length field */ @@ -722,7 +722,7 @@ static void dissect_rlc_umts(tvbuff_t *tvb, gint offset, } /* Keep going until reach data tag or end of frame */ - while ((tag != 0x41) && tvb_length_remaining(tvb, offset)) { /* i.e. Data */ + while ((tag != 0x41) && tvb_reported_length_remaining(tvb, offset)) { /* i.e. Data */ tag = tvb_get_guint8(tvb, offset++); switch (tag) { case 0x72: /* UE Id */ @@ -1022,7 +1022,7 @@ static void dissect_rrc_lte(tvbuff_t *tvb, gint offset, } /* Send to RRC dissector, if got here, have sub-dissector and some data left */ - if ((protocol_handle != NULL) && (tvb_length_remaining(tvb, offset) > 0)) { + if ((protocol_handle != NULL) && (tvb_reported_length_remaining(tvb, offset) > 0)) { rrc_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector_only(protocol_handle, rrc_tvb, pinfo, tree, NULL); } @@ -1084,7 +1084,7 @@ static void dissect_ccpri_lte(tvbuff_t *tvb, gint offset, /* Send remainder to lapb dissector (lapb needs patch with preference set to call cpri C&M dissector instead of X.25) */ protocol_handle = find_dissector("lapb"); - if ((protocol_handle != NULL) && (tvb_length_remaining(tvb, offset) > 0)) { + if ((protocol_handle != NULL) && (tvb_reported_length_remaining(tvb, offset) > 0)) { ccpri_tvb = tvb_new_subset_length(tvb, offset, length); call_dissector_only(protocol_handle, ccpri_tvb, pinfo, tree, NULL); } @@ -1248,7 +1248,7 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, gint offset, /* Other optional fields may follow */ tag = tvb_get_guint8(tvb, offset++); - while ((tag != 0x41) && (tvb_length_remaining(tvb, offset) > 2)) { + while ((tag != 0x41) && (tvb_reported_length_remaining(tvb, offset) > 2)) { if (tag == 0x35) { /* This is MUI */ @@ -1927,7 +1927,7 @@ static void dissect_tty_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /* Otherwise show as $hex */ int n, idx; char *hex_string; - int tty_string_length = tvb_length_remaining(tvb, offset); + int tty_string_length = tvb_reported_length_remaining(tvb, offset); int hex_string_length = 1+(2*tty_string_length)+1; hex_string = (char *)wmem_alloc(wmem_packet_scope(), hex_string_length); @@ -2458,7 +2458,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (strcmp(protocol_name, "comment") == 0) { /* Extract & add the string. */ proto_item *string_ti; - char *string = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_length_remaining(tvb, offset), ENC_ASCII); + char *string = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII); /* Show comment string */ string_ti = proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_comment, tvb, @@ -2485,7 +2485,7 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else if (strcmp(protocol_name, "sprint") == 0) { /* Extract & add the string. */ - char *string = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_length_remaining(tvb, offset), ENC_ASCII); + char *string = (char*)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII); /* Show sprint string */ proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_sprint, tvb, diff --git a/epan/dissectors/packet-cell_broadcast.c b/epan/dissectors/packet-cell_broadcast.c index afbf20aeab..c28c7db80e 100644 --- a/epan/dissectors/packet-cell_broadcast.c +++ b/epan/dissectors/packet-cell_broadcast.c @@ -253,7 +253,7 @@ guint dissect_cbs_message_identifier(tvbuff_t *tvb, proto_tree *tree, guint offs tvbuff_t * dissect_cbs_data(guint8 sms_encoding, tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint offset ) { tvbuff_t * tvb_out = NULL; - int length = tvb_length(tvb) - offset; + int length = tvb_reported_length(tvb) - offset; gchar *utf8_text = NULL, *utf8_out; switch(sms_encoding){ @@ -308,7 +308,7 @@ dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvbuff_t *cbs_msg_tvb = NULL; fragment_head * frag_data = NULL; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); col_append_str(pinfo->cinfo, COL_PROTOCOL, " Cell Broadcast"); col_append_str(pinfo->cinfo, COL_INFO, " (CBS Page)"); @@ -330,7 +330,7 @@ dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (cbs_page_tvb != NULL) { - text_len = tvb_length(cbs_page_tvb); + text_len = tvb_reported_length(cbs_page_tvb); while (text_len && (tvb_get_guint8(cbs_page_tvb, text_len-1) == '\r')) { text_len--; } @@ -338,7 +338,7 @@ dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *cbs_page_subtree = proto_tree_add_subtree(cbs_page_tree, tvb, offset, -1, ett_gsm_cbs_page_content, NULL, "Cell Broadcast Page Contents"); - len = tvb_length(cbs_page_tvb); + len = tvb_reported_length(cbs_page_tvb); proto_tree_add_string(cbs_page_subtree, hf_gsm_cbs_page_content, cbs_page_tvb, 0, text_len, tvb_get_string_enc(wmem_packet_scope(), cbs_page_tvb, 0, text_len, ENC_ASCII)); len -= text_len; @@ -375,7 +375,7 @@ dissect_gsm_cell_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *cbs_msg_item = NULL; proto_tree *cbs_msg_tree = NULL; - len = tvb_length(cbs_msg_tvb); + len = tvb_reported_length(cbs_msg_tvb); col_append_str(pinfo->cinfo, COL_INFO, " (CBS Message)"); cbs_msg_item = proto_tree_add_protocol_format(proto_tree_get_root(tree), proto_cell_broadcast, cbs_msg_tvb, 0, len, "GSM Cell Broadcast Message"); @@ -396,7 +396,7 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot guint8 *msg; tvbuff_t * cbs_msg_tvb = NULL; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); col_append_str(pinfo->cinfo, COL_PROTOCOL, " Cell Broadcast"); col_append_str(pinfo->cinfo, COL_INFO, " (CBS Message)"); @@ -408,7 +408,7 @@ void dissect_umts_cell_broadcast_message(tvbuff_t *tvb, packet_info *pinfo, prot offset++; cbs_msg_tvb = dissect_cbs_data(sms_encoding, tvb, cbs_tree, pinfo, offset ); - msg_len = tvb_length(cbs_msg_tvb); + msg_len = tvb_reported_length(cbs_msg_tvb); cbs_subtree = proto_tree_add_subtree_format(cbs_tree, tvb, offset, -1, ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len); msg = tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII); diff --git a/epan/dissectors/packet-cigi.c b/epan/dissectors/packet-cigi.c index 93ef9cfcb1..3511c88b4d 100644 --- a/epan/dissectors/packet-cigi.c +++ b/epan/dissectors/packet-cigi.c @@ -2453,7 +2453,7 @@ packet_is_cigi(tvbuff_t *tvb) /* CIGI 3 */ guint16 byte_swap; - if (tvb_length(tvb) < 3) { + if (tvb_captured_length(tvb) < 3) { /* Not enough data available to check */ return FALSE; } @@ -2607,7 +2607,7 @@ dissect_cigi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ } dissect_cigi_pdu(tvb, pinfo, tree); /* We probably ate the entire packet. */ - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* Code to actually dissect the CIGI packets */ @@ -2656,7 +2656,7 @@ dissect_cigi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tree) { - ti = proto_tree_add_protocol_format(tree, proto_cigi, tvb, 0, tvb_length(tvb), "Common Image Generator Interface (%i), %s => %s (%u bytes)", + ti = proto_tree_add_protocol_format(tree, proto_cigi, tvb, 0, tvb_reported_length(tvb), "Common Image Generator Interface (%i), %s => %s (%u bytes)", cigi_version, src_str, dest_str, tvb_reported_length(tvb)); cigi_tree = proto_item_add_subtree(ti, ett_cigi); @@ -2705,7 +2705,7 @@ cigi_add_tree(tvbuff_t *tvb, proto_tree *cigi_tree) proto_tree* cigi_packet_tree = NULL; proto_item* tipacket; - length = tvb_length(tvb); + length = tvb_reported_length(tvb); /* Each iteration through this loop is meant to be a separate cigi packet * therefore it is okay to assume that at the top of this look we are given @@ -2796,7 +2796,7 @@ cigi2_add_tree(tvbuff_t *tvb, proto_tree *cigi_tree) proto_item* tipacket; int hf_cigi2_packet = -1; - length = tvb_length(tvb); + length = tvb_reported_length(tvb); /* Each iteration through this loop is meant to be a separate cigi packet * therefore it is okay to assume that at the top of this look we are given @@ -3024,7 +3024,7 @@ cigi3_add_tree(tvbuff_t *tvb, proto_tree *cigi_tree) proto_item* tipacket; int hf_cigi3_packet = -1; - length = tvb_length(tvb); + length = tvb_reported_length(tvb); /* Each iteration through this loop is meant to be a separate cigi packet * therefore it is okay to assume that at the top of this look we are given diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index 8df721ff2e..55b9e2614f 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -4141,9 +4141,9 @@ dissect_cip_class_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v ti = proto_tree_add_item(tree, proto_cip_class_generic, tvb, 0, -1, ENC_NA); class_tree = proto_item_add_subtree( ti, ett_cip_class_generic ); - dissect_cip_generic_data( class_tree, tvb, 0, tvb_length(tvb), pinfo, ti ); + dissect_cip_generic_data( class_tree, tvb, 0, tvb_reported_length(tvb), pinfo, ti ); - return tvb_length(tvb); + return tvb_reported_length(tvb); } static void @@ -4454,7 +4454,7 @@ dissect_cip_generic_service_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t break; } - return tvb_length(tvb); + return tvb_reported_length(tvb); } static void @@ -4711,7 +4711,7 @@ dissect_cip_generic_service_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t cip_req_info_t* preq_info; cip_simple_request_info_t req_data; int offset = 0, - item_length = tvb_length(tvb); + item_length = tvb_reported_length(tvb); guint8 service = tvb_get_guint8( tvb, offset ) & CIP_SC_MASK, add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2; @@ -4725,7 +4725,7 @@ dissect_cip_generic_service_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t else { /* PROTO_ITEM_SET_HIDDEN( ti ); */ - return tvb_length(tvb); + return tvb_reported_length(tvb); } preq_info = (cip_req_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_cip, 0); @@ -4814,7 +4814,7 @@ dissect_cip_generic_service_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t break; } - return tvb_length(tvb); + return tvb_reported_length(tvb); } /************************************************ @@ -5482,9 +5482,9 @@ dissect_cip_class_cm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * ti = proto_tree_add_item(tree, proto_cip_class_cm, tvb, 0, -1, ENC_NA); class_tree = proto_item_add_subtree( ti, ett_cip_class_cm ); - dissect_cip_cm_data( class_tree, tvb, 0, tvb_length(tvb), pinfo ); + dissect_cip_cm_data( class_tree, tvb, 0, tvb_reported_length(tvb), pinfo ); - return tvb_length(tvb); + return tvb_reported_length(tvb); } /************************************************ @@ -5565,7 +5565,7 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ case SC_MB_PASSTHROUGH: /* Passthrough response (Success) */ - if( tvb_length_remaining(tvb, offset) > 0 ) + if( tvb_reported_length_remaining(tvb, offset) > 0 ) { /* dissect the Modbus PDU */ next_tvb = tvb_new_subset_length( tvb, offset+4+add_stat_size, item_length-4-add_stat_size); @@ -5655,7 +5655,7 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ case SC_MB_PASSTHROUGH: /* Passthrough Request */ - if( tvb_length_remaining(tvb, offset) > 0 ) + if( tvb_reported_length_remaining(tvb, offset) > 0 ) { /* dissect the Modbus PDU */ next_tvb = tvb_new_subset_length( tvb, offset+2+req_path_size, item_length-req_path_size-2); @@ -5692,9 +5692,9 @@ dissect_cip_class_mb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * ti = proto_tree_add_item(tree, proto_cip_class_mb, tvb, 0, -1, ENC_NA); class_tree = proto_item_add_subtree( ti, ett_cip_class_mb ); - dissect_cip_mb_data( class_tree, tvb, 0, tvb_length(tvb), pinfo ); + dissect_cip_mb_data( class_tree, tvb, 0, tvb_reported_length(tvb), pinfo ); - return tvb_length(tvb); + return tvb_reported_length(tvb); } /************************************************ @@ -6034,9 +6034,9 @@ dissect_cip_class_cco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void ti = proto_tree_add_item(tree, proto_cip_class_cco, tvb, 0, -1, ENC_NA); class_tree = proto_item_add_subtree( ti, ett_cip_class_cco ); - dissect_cip_cco_data( class_tree, tvb, 0, tvb_length(tvb), pinfo ); + dissect_cip_cco_data( class_tree, tvb, 0, tvb_reported_length(tvb), pinfo ); - return tvb_length(tvb); + return tvb_reported_length(tvb); } static gboolean @@ -6344,7 +6344,7 @@ dissect_cip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) dissect_cip_data( tree, tvb, 0, pinfo, NULL ); } - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* diff --git a/epan/dissectors/packet-cipsafety.c b/epan/dissectors/packet-cipsafety.c index 3cf7835e37..051b369545 100644 --- a/epan/dissectors/packet-cipsafety.c +++ b/epan/dissectors/packet-cipsafety.c @@ -735,9 +735,9 @@ dissect_cip_class_s_supervisor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr ti = proto_tree_add_item(tree, proto_cip_class_s_supervisor, tvb, 0, -1, ENC_NA); class_tree = proto_item_add_subtree( ti, ett_cip_class_s_supervisor ); - dissect_cip_s_supervisor_data( class_tree, tvb, 0, tvb_length(tvb), pinfo ); + dissect_cip_s_supervisor_data( class_tree, tvb, 0, tvb_reported_length(tvb), pinfo ); - return tvb_length(tvb); + return tvb_reported_length(tvb); } static int dissect_s_supervisor_exception_detail(proto_tree *tree, proto_item *item, tvbuff_t *tvb, int offset, int hf_size, int hf_data) @@ -1287,9 +1287,9 @@ dissect_cip_class_s_validator(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre ti = proto_tree_add_item(tree, proto_cip_class_s_validator, tvb, 0, -1, ENC_NA); class_tree = proto_item_add_subtree( ti, ett_cip_class_s_validator ); - dissect_cip_s_validator_data( class_tree, tvb, 0, tvb_length(tvb), pinfo ); + dissect_cip_s_validator_data( class_tree, tvb, 0, tvb_reported_length(tvb), pinfo ); - return tvb_length(tvb); + return tvb_reported_length(tvb); } static gboolean @@ -1613,7 +1613,7 @@ dissect_cipsafety(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, proto_cipsafety, tvb, 0, -1, ENC_NA); safety_tree = proto_item_add_subtree( ti, ett_cip_safety); - dissect_cip_safety_data(safety_tree, ti, tvb, tvb_length(tvb), pinfo ); + dissect_cip_safety_data(safety_tree, ti, tvb, tvb_reported_length(tvb), pinfo ); } static int dissect_sercosiii_link_error_count_p1p2(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb, diff --git a/epan/dissectors/packet-cisco-wids.c b/epan/dissectors/packet-cisco-wids.c index 559f31288c..bd0b3b7f4a 100644 --- a/epan/dissectors/packet-cisco-wids.c +++ b/epan/dissectors/packet-cisco-wids.c @@ -82,7 +82,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cwids_tree = NULL; - while(tvb_length_remaining(tvb, offset) > 0) { + while(tvb_reported_length_remaining(tvb, offset) > 0) { ti = proto_tree_add_item(tree, proto_cwids, tvb, offset, 28, ENC_NA); cwids_tree = proto_item_add_subtree(ti, ett_cwids); diff --git a/epan/dissectors/packet-classicstun.c b/epan/dissectors/packet-classicstun.c index 789ff6db96..c5db4db3a4 100644 --- a/epan/dissectors/packet-classicstun.c +++ b/epan/dissectors/packet-classicstun.c @@ -231,7 +231,7 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d /* * First check if the frame is really meant for us. */ - len = tvb_length(tvb); + len = tvb_captured_length(tvb); /* First, make sure we have enough data to do the check. */ if (len < CLASSICSTUN_HDR_LEN) return 0; @@ -538,7 +538,7 @@ dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d } } } - return tvb_length(tvb); + return tvb_reported_length(tvb); } diff --git a/epan/dissectors/packet-clique-rm.c b/epan/dissectors/packet-clique-rm.c index d743817702..1750693a73 100644 --- a/epan/dissectors/packet-clique-rm.c +++ b/epan/dissectors/packet-clique-rm.c @@ -272,7 +272,7 @@ dissect_clique_rm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat int offset = 0; guint64 qword; - if (tvb_length(tvb) < 12) + if (tvb_captured_length(tvb) < 12) return FALSE; qword = tvb_get_ntoh48(tvb,0); diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c index 922b766acb..8b3a5eb6ec 100644 --- a/epan/dissectors/packet-clnp.c +++ b/epan/dissectors/packet-clnp.c @@ -308,7 +308,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) or not - set the Info column now; we'll get an exception before we set it otherwise. */ - if (tvb_length(tvb) < cnf_hdr_len) { + if (tvb_reported_length(tvb) < cnf_hdr_len) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); } @@ -567,7 +567,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect it as a CLNP PDU. */ col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); - next_length = tvb_length_remaining(tvb, offset); + next_length = tvb_reported_length_remaining(tvb, offset); if (next_length != 0) { /* We have payload; dissect it. */ discpdu_tree = proto_tree_add_subtree(clnp_tree, tvb, offset, next_length, diff --git a/epan/dissectors/packet-componentstatus.c b/epan/dissectors/packet-componentstatus.c index 8de35bc6d8..4e9ab5750a 100644 --- a/epan/dissectors/packet-componentstatus.c +++ b/epan/dissectors/packet-componentstatus.c @@ -175,7 +175,7 @@ dissect_componentstatusprotocol_componentstatusreport_message(tvbuff_t *message_ association_tree = proto_tree_add_subtree_format(message_tree, message_tvb, offset, COMPONENTASSOCIATION_LENGTH, ett_association, NULL, "Association #%d", i++); association_tvb = tvb_new_subset(message_tvb, offset, - MIN(COMPONENTASSOCIATION_LENGTH, tvb_length_remaining(message_tvb, offset)), + MIN(COMPONENTASSOCIATION_LENGTH, tvb_reported_length_remaining(message_tvb, offset)), COMPONENTASSOCIATION_LENGTH); dissect_componentstatusprotocol_componentassociation_message(association_tvb, association_tree); @@ -217,7 +217,7 @@ dissect_componentstatusprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto gint8 type; gint32 version; - if (tvb_length(message_tvb) < (MESSAGE_VERSION_OFFSET + MESSAGE_VERSION_LENGTH)) + if (tvb_reported_length(message_tvb) < (MESSAGE_VERSION_OFFSET + MESSAGE_VERSION_LENGTH)) return(0); /* Check, if this packet really contains a ComponentStatusProtocol message */ @@ -238,7 +238,7 @@ dissect_componentstatusprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto /* dissect the message */ dissect_componentstatusprotocol_message(message_tvb, pinfo, componentstatusprotocol_tree); - return(tvb_length(message_tvb)); + return(tvb_reported_length(message_tvb)); } diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 2d372ad499..58a8ea5415 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -987,7 +987,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data offset += object_len; } - garbage = tvb_length_remaining(tvb, offset); + garbage = tvb_reported_length_remaining(tvb, offset); if (garbage > 0) { proto_tree_add_expert_format(tree, pinfo, &ei_cops_trailing_garbage, tvb, offset, garbage, "Trailing garbage: %d byte%s", garbage, plurality(garbage, "", "s")); } @@ -1122,7 +1122,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } } - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* Code to actually dissect the packets */ @@ -1131,7 +1131,7 @@ dissect_cops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, cops_desegment, 8, get_cops_pdu_len, dissect_cops_pdu, data); - return tvb_length(tvb); + return tvb_reported_length(tvb); } static const char *cops_c_type_to_str(guint8 c_num, guint8 c_type) @@ -1585,7 +1585,7 @@ static int dissect_cops_pr_object_data(tvbuff_t *tvb, packet_info *pinfo, guint3 gint encoid_len; guint8* encoid; - encoid_len = tvb_length_remaining(oid_tvb,0); + encoid_len = tvb_reported_length_remaining(oid_tvb,0); if (encoid_len > 0) { encoid = (guint8*)tvb_memdup(wmem_packet_scope(),oid_tvb,0,encoid_len); (*pprid_subids_len) = oid_encoded2subid(wmem_packet_scope(), encoid, encoid_len, pprid_subids); @@ -5944,7 +5944,7 @@ cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree } /* Do the remaining client specific objects */ - remdata = tvb_length_remaining(tvb, offset); + remdata = tvb_reported_length_remaining(tvb, offset); while (remdata > 4) { /* In case we have remaining data, then lets try to get this analyzed */ @@ -6002,7 +6002,7 @@ cops_analyze_packetcable_dqos_obj(tvbuff_t *tvb, packet_info *pinfo, proto_tree offset += object_len; /* See what we can still get from the buffer */ - remdata = tvb_length_remaining(tvb, offset); + remdata = tvb_reported_length_remaining(tvb, offset); } } diff --git a/epan/dissectors/packet-cpfi.c b/epan/dissectors/packet-cpfi.c index 81b46d78db..532be332e7 100644 --- a/epan/dissectors/packet-cpfi.c +++ b/epan/dissectors/packet-cpfi.c @@ -326,7 +326,7 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void * if (pinfo->dst.type != AT_ETHER || pinfo->src.type != AT_ETHER) return 0; - length = tvb_length_remaining(message_tvb, 8); + length = tvb_captured_length_remaining(message_tvb, 8); reported_length = tvb_reported_length_remaining(message_tvb, 8); if (reported_length < 8) { @@ -341,7 +341,7 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void * if (body_length > reported_body_length) body_length = reported_body_length; - length = tvb_length_remaining(message_tvb, 8+body_length); + length = tvb_captured_length_remaining(message_tvb, 8+body_length); if (length < 0) { /* The footer wasn't captured at all. @@ -381,7 +381,7 @@ dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void * footer_tvb = tvb_new_subset(message_tvb, 8+body_length, length, 8); dissect_cpfi_footer(footer_tvb, cpfi_tree); - return(tvb_length(message_tvb)); + return(tvb_reported_length(message_tvb)); } diff --git a/epan/dissectors/packet-ctdb.c b/epan/dissectors/packet-ctdb.c index d53d1a0400..c1d9a7c57c 100644 --- a/epan/dissectors/packet-ctdb.c +++ b/epan/dissectors/packet-ctdb.c @@ -978,7 +978,7 @@ dissect_ctdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *d int endianess; /* does this look like CTDB? */ - if(tvb_length_remaining(tvb, offset)<8){ + if(tvb_captured_length(tvb)<8){ return FALSE; } switch(tvb_get_letohl(tvb, offset+4)){ diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c index c28b6cc5b1..a9576bcd7a 100644 --- a/epan/dissectors/packet-data.c +++ b/epan/dissectors/packet-data.c @@ -63,7 +63,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) gint bytes; if (tree) { - bytes = tvb_length_remaining(tvb, 0); + bytes = tvb_captured_length(tvb); if (bytes > 0) { tvbuff_t *data_tvb; proto_item *ti;