Replace deprecated tvb_length APIs

Change-Id: Idfd3bed012e823de544fe4de483c8f095fc7c65d
Reviewed-on: https://code.wireshark.org/review/8086
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
AndersBroman 2015-04-16 13:31:57 +02:00 committed by Anders Broman
parent 2d79f56df1
commit 95f138e407
16 changed files with 68 additions and 68 deletions

View File

@ -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 /* First some simple check if the data is
really CARP */ really CARP */
if (tvb_length(tvb) < 36) if (tvb_captured_length(tvb) < 36)
return FALSE; return FALSE;
/* Version must be 1 or 2, type must be in carp_type_vals */ /* 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); cksum = tvb_get_ntohs(tvb, offset);
ti = proto_tree_add_item(carp_tree, hf_carp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN); ti = proto_tree_add_item(carp_tree, hf_carp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
carp_len = tvb_reported_length(tvb); 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 /* The packet isn't part of a fragmented datagram
and isn't truncated, so we can checksum it. */ and isn't truncated, so we can checksum it. */
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, carp_len); SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, carp_len);

View File

@ -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 */ /* 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_data_length = tvb_get_letohl(tvb, 0);
hdr_marker = tvb_get_letohl(tvb, 4); 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) { if (hdr_data_length < 4 || hdr_marker != 0) {
return 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"); 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); 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 */ /* Register the protocol with Wireshark */

View File

@ -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 */ /* 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 */ /* Look at next tag */
tag = tvb_get_guint8(tvb, offset++); 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); offset += skipASNLength(first_length_byte);
/* Skip any other fields before reach payload */ /* 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 */ /* Look at next tag */
tag = tvb_get_guint8(tvb, offset++); 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; offset += 2;
/* Some optional params */ /* Some optional params */
while ((tag != 0x0c00) && (tvb_length_remaining(tvb, offset) > 4)) { while ((tag != 0x0c00) && (tvb_reported_length_remaining(tvb, offset) > 4)) {
switch (tag) { switch (tag) {
case 0x0900: /* Dest address */ case 0x0900: /* Dest address */
/* Length field */ /* 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 */ /* 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++); tag = tvb_get_guint8(tvb, offset++);
switch (tag) { switch (tag) {
case 0x72: /* UE Id */ 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 */ /* 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); rrc_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector_only(protocol_handle, rrc_tvb, pinfo, tree, NULL); 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 /* Send remainder to lapb dissector (lapb needs patch with preference
set to call cpri C&M dissector instead of X.25) */ set to call cpri C&M dissector instead of X.25) */
protocol_handle = find_dissector("lapb"); 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); ccpri_tvb = tvb_new_subset_length(tvb, offset, length);
call_dissector_only(protocol_handle, ccpri_tvb, pinfo, tree, NULL); 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 */ /* Other optional fields may follow */
tag = tvb_get_guint8(tvb, offset++); 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) { if (tag == 0x35) {
/* This is MUI */ /* 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 */ /* Otherwise show as $hex */
int n, idx; int n, idx;
char *hex_string; 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; int hex_string_length = 1+(2*tty_string_length)+1;
hex_string = (char *)wmem_alloc(wmem_packet_scope(), hex_string_length); 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) { if (strcmp(protocol_name, "comment") == 0) {
/* Extract & add the string. */ /* Extract & add the string. */
proto_item *string_ti; 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 */ /* Show comment string */
string_ti = proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_comment, tvb, 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 else
if (strcmp(protocol_name, "sprint") == 0) { if (strcmp(protocol_name, "sprint") == 0) {
/* Extract & add the string. */ /* 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 */ /* Show sprint string */
proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_sprint, tvb, proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_sprint, tvb,

View File

@ -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 * dissect_cbs_data(guint8 sms_encoding, tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint offset )
{ {
tvbuff_t * tvb_out = NULL; tvbuff_t * tvb_out = NULL;
int length = tvb_length(tvb) - offset; int length = tvb_reported_length(tvb) - offset;
gchar *utf8_text = NULL, *utf8_out; gchar *utf8_text = NULL, *utf8_out;
switch(sms_encoding){ 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; tvbuff_t *cbs_msg_tvb = NULL;
fragment_head * frag_data = 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_PROTOCOL, " Cell Broadcast");
col_append_str(pinfo->cinfo, COL_INFO, " (CBS Page)"); 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) 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')) { while (text_len && (tvb_get_guint8(cbs_page_tvb, text_len-1) == '\r')) {
text_len--; 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, 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"); 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, 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)); text_len, tvb_get_string_enc(wmem_packet_scope(), cbs_page_tvb, 0, text_len, ENC_ASCII));
len -= text_len; 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_item *cbs_msg_item = NULL;
proto_tree *cbs_msg_tree = 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)"); 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"); 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; guint8 *msg;
tvbuff_t * cbs_msg_tvb = NULL; 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_PROTOCOL, " Cell Broadcast");
col_append_str(pinfo->cinfo, COL_INFO, " (CBS Message)"); 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++; offset++;
cbs_msg_tvb = dissect_cbs_data(sms_encoding, tvb, cbs_tree, pinfo, 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, cbs_subtree = proto_tree_add_subtree_format(cbs_tree, tvb, offset, -1,
ett_cbs_msg, NULL, "Cell Broadcast Message Contents (length: %d)", msg_len); 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); msg = tvb_get_string_enc(wmem_packet_scope(), cbs_msg_tvb, 0, msg_len, ENC_ASCII);

View File

@ -2453,7 +2453,7 @@ packet_is_cigi(tvbuff_t *tvb)
/* CIGI 3 */ /* CIGI 3 */
guint16 byte_swap; guint16 byte_swap;
if (tvb_length(tvb) < 3) { if (tvb_captured_length(tvb) < 3) {
/* Not enough data available to check */ /* Not enough data available to check */
return FALSE; 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); dissect_cigi_pdu(tvb, pinfo, tree);
/* We probably ate the entire packet. */ /* We probably ate the entire packet. */
return tvb_length(tvb); return tvb_reported_length(tvb);
} }
/* Code to actually dissect the CIGI packets */ /* 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) { 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_version, src_str, dest_str, tvb_reported_length(tvb));
cigi_tree = proto_item_add_subtree(ti, ett_cigi); 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_tree* cigi_packet_tree = NULL;
proto_item* tipacket; 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 /* 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 * 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; proto_item* tipacket;
int hf_cigi2_packet = -1; 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 /* 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 * 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; proto_item* tipacket;
int hf_cigi3_packet = -1; 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 /* 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 * therefore it is okay to assume that at the top of this look we are given

View File

@ -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); 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 ); 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 static void
@ -4454,7 +4454,7 @@ dissect_cip_generic_service_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
break; break;
} }
return tvb_length(tvb); return tvb_reported_length(tvb);
} }
static void 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_req_info_t* preq_info;
cip_simple_request_info_t req_data; cip_simple_request_info_t req_data;
int offset = 0, int offset = 0,
item_length = tvb_length(tvb); item_length = tvb_reported_length(tvb);
guint8 service = tvb_get_guint8( tvb, offset ) & CIP_SC_MASK, guint8 service = tvb_get_guint8( tvb, offset ) & CIP_SC_MASK,
add_stat_size = tvb_get_guint8( tvb, offset+3 ) * 2; 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 else
{ {
/* PROTO_ITEM_SET_HIDDEN( ti ); */ /* 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); 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; 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); 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 ); 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: case SC_MB_PASSTHROUGH:
/* Passthrough response (Success) */ /* Passthrough response (Success) */
if( tvb_length_remaining(tvb, offset) > 0 ) if( tvb_reported_length_remaining(tvb, offset) > 0 )
{ {
/* dissect the Modbus PDU */ /* dissect the Modbus PDU */
next_tvb = tvb_new_subset_length( tvb, offset+4+add_stat_size, item_length-4-add_stat_size); 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: case SC_MB_PASSTHROUGH:
/* Passthrough Request */ /* Passthrough Request */
if( tvb_length_remaining(tvb, offset) > 0 ) if( tvb_reported_length_remaining(tvb, offset) > 0 )
{ {
/* dissect the Modbus PDU */ /* dissect the Modbus PDU */
next_tvb = tvb_new_subset_length( tvb, offset+2+req_path_size, item_length-req_path_size-2); 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); 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 ); 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); 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 ); 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 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 ); dissect_cip_data( tree, tvb, 0, pinfo, NULL );
} }
return tvb_length(tvb); return tvb_reported_length(tvb);
} }
/* /*

View File

@ -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); 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 ); 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) 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); 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 ); 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 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); ti = proto_tree_add_item(tree, proto_cipsafety, tvb, 0, -1, ENC_NA);
safety_tree = proto_item_add_subtree( ti, ett_cip_safety); 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, static int dissect_sercosiii_link_error_count_p1p2(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,

View File

@ -82,7 +82,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
cwids_tree = NULL; 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); ti = proto_tree_add_item(tree, proto_cwids, tvb, offset, 28, ENC_NA);
cwids_tree = proto_item_add_subtree(ti, ett_cwids); cwids_tree = proto_item_add_subtree(ti, ett_cwids);

View File

@ -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. * 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. */ /* First, make sure we have enough data to do the check. */
if (len < CLASSICSTUN_HDR_LEN) if (len < CLASSICSTUN_HDR_LEN)
return 0; 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);
} }

View File

@ -272,7 +272,7 @@ dissect_clique_rm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
int offset = 0; int offset = 0;
guint64 qword; guint64 qword;
if (tvb_length(tvb) < 12) if (tvb_captured_length(tvb) < 12)
return FALSE; return FALSE;
qword = tvb_get_ntoh48(tvb,0); qword = tvb_get_ntoh48(tvb,0);

View File

@ -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 or not - set the Info column now; we'll get an exception before
we set it otherwise. */ 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); 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. */ dissect it as a CLNP PDU. */
col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); 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) { if (next_length != 0) {
/* We have payload; dissect it. */ /* We have payload; dissect it. */
discpdu_tree = proto_tree_add_subtree(clnp_tree, tvb, offset, next_length, discpdu_tree = proto_tree_add_subtree(clnp_tree, tvb, offset, next_length,

View File

@ -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, association_tree = proto_tree_add_subtree_format(message_tree, message_tvb, offset, COMPONENTASSOCIATION_LENGTH,
ett_association, NULL, "Association #%d", i++); ett_association, NULL, "Association #%d", i++);
association_tvb = tvb_new_subset(message_tvb, offset, 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); COMPONENTASSOCIATION_LENGTH);
dissect_componentstatusprotocol_componentassociation_message(association_tvb, association_tree); dissect_componentstatusprotocol_componentassociation_message(association_tvb, association_tree);
@ -217,7 +217,7 @@ dissect_componentstatusprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto
gint8 type; gint8 type;
gint32 version; 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); return(0);
/* Check, if this packet really contains a ComponentStatusProtocol message */ /* 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 the message */
dissect_componentstatusprotocol_message(message_tvb, pinfo, componentstatusprotocol_tree); dissect_componentstatusprotocol_message(message_tvb, pinfo, componentstatusprotocol_tree);
return(tvb_length(message_tvb)); return(tvb_reported_length(message_tvb));
} }

View File

@ -987,7 +987,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
offset += object_len; offset += object_len;
} }
garbage = tvb_length_remaining(tvb, offset); garbage = tvb_reported_length_remaining(tvb, offset);
if (garbage > 0) { 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")); 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 */ /* 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, tcp_dissect_pdus(tvb, pinfo, tree, cops_desegment, 8,
get_cops_pdu_len, dissect_cops_pdu, data); 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) 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; gint encoid_len;
guint8* encoid; guint8* encoid;
encoid_len = tvb_length_remaining(oid_tvb,0); encoid_len = tvb_reported_length_remaining(oid_tvb,0);
if (encoid_len > 0) { if (encoid_len > 0) {
encoid = (guint8*)tvb_memdup(wmem_packet_scope(),oid_tvb,0,encoid_len); 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); (*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 */ /* Do the remaining client specific objects */
remdata = tvb_length_remaining(tvb, offset); remdata = tvb_reported_length_remaining(tvb, offset);
while (remdata > 4) { while (remdata > 4) {
/* In case we have remaining data, then lets try to get this analyzed */ /* 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; offset += object_len;
/* See what we can still get from the buffer */ /* See what we can still get from the buffer */
remdata = tvb_length_remaining(tvb, offset); remdata = tvb_reported_length_remaining(tvb, offset);
} }
} }

View File

@ -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) if (pinfo->dst.type != AT_ETHER || pinfo->src.type != AT_ETHER)
return 0; 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); reported_length = tvb_reported_length_remaining(message_tvb, 8);
if (reported_length < 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) if (body_length > reported_body_length)
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) if (length < 0)
{ {
/* The footer wasn't captured at all. /* 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); footer_tvb = tvb_new_subset(message_tvb, 8+body_length, length, 8);
dissect_cpfi_footer(footer_tvb, cpfi_tree); dissect_cpfi_footer(footer_tvb, cpfi_tree);
return(tvb_length(message_tvb)); return(tvb_reported_length(message_tvb));
} }

View File

@ -978,7 +978,7 @@ dissect_ctdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *d
int endianess; int endianess;
/* does this look like CTDB? */ /* does this look like CTDB? */
if(tvb_length_remaining(tvb, offset)<8){ if(tvb_captured_length(tvb)<8){
return FALSE; return FALSE;
} }
switch(tvb_get_letohl(tvb, offset+4)){ switch(tvb_get_letohl(tvb, offset+4)){

View File

@ -63,7 +63,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
gint bytes; gint bytes;
if (tree) { if (tree) {
bytes = tvb_length_remaining(tvb, 0); bytes = tvb_captured_length(tvb);
if (bytes > 0) { if (bytes > 0) {
tvbuff_t *data_tvb; tvbuff_t *data_tvb;
proto_item *ti; proto_item *ti;