diff options
author | AndersBroman <anders.broman@ericsson.com> | 2014-11-21 15:54:59 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-11-21 15:05:33 +0000 |
commit | f2fc562edaa71316b0da541a8c95e29953cdd944 (patch) | |
tree | 371fe8ac3eec3cf591682105ac74f54fe5eaac18 /epan/dissectors | |
parent | 96fb34706b972c55706f0be35172b0a248263e3c (diff) |
Replace tvb_length()
Change-Id: I0b5ad4d588f0b658abaf3892d08d6520ecd2f645
Reviewed-on: https://code.wireshark.org/review/5431
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-gsmtap.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-h221_nonstd.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-h223.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-m2pa.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-m2ua.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-m3ua.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-mac-lte-framed.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-media.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-mgcp.c | 20 | ||||
-rw-r--r-- | epan/dissectors/packet-mp4ves.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp2.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-multipart.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-nb_rtpmux.c | 6 |
14 files changed, 54 insertions, 54 deletions
diff --git a/epan/dissectors/packet-gsmtap.c b/epan/dissectors/packet-gsmtap.c index bc7fb5e76d..1d5d07714a 100644 --- a/epan/dissectors/packet-gsmtap.c +++ b/epan/dissectors/packet-gsmtap.c @@ -476,7 +476,7 @@ dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 hdr_len, type, sub_type, timeslot, subslot; guint16 arfcn; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); hdr_len = tvb_get_guint8(tvb, offset + 1) <<2; type = tvb_get_guint8(tvb, offset + 2); diff --git a/epan/dissectors/packet-h221_nonstd.c b/epan/dissectors/packet-h221_nonstd.c index 01b56849b6..6510bb8d83 100644 --- a/epan/dissectors/packet-h221_nonstd.c +++ b/epan/dissectors/packet-h221_nonstd.c @@ -61,7 +61,7 @@ dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) gint tvb_len; guint16 codec_extra; - it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_length(tvb), "Microsoft NonStd"); + it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_reported_length(tvb), "Microsoft NonStd"); tr=proto_item_add_subtree(it, ett_nonstd); diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c index 776874e1c8..581ea1a94f 100644 --- a/epan/dissectors/packet-h223.c +++ b/epan/dissectors/packet-h223.c @@ -979,7 +979,7 @@ dissect_mux_pdu( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, end_of_mux_sdu = raw_hdr & 1; offset++; /* closing flag is one byte long for h223 level 0, two for level 1 */ - len = mpl = tvb_length_remaining(tvb, offset)-(call_info->h223_level+1); + len = mpl = tvb_reported_length_remaining(tvb, offset)-(call_info->h223_level+1); /* XXX should ignore pdus with incorrect HECs */ break; @@ -988,7 +988,7 @@ dissect_mux_pdu( tvbuff_t *tvb, packet_info *pinfo, guint32 pkt_offset, raw_hdr = tvb_get_letoh24(tvb,0); errors = golay_errors(raw_hdr); offset += 3; - len = tvb_length_remaining(tvb,offset)-2; + len = tvb_reported_length_remaining(tvb,offset)-2; if(errors != -1) { correct_hdr = raw_hdr ^ (guint32)errors; @@ -1398,7 +1398,7 @@ dissect_h223_bitswapped_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint8 *datax; guint len; - len = tvb_length(tvb); + len = tvb_reported_length(tvb); datax = (guint8 *) tvb_memdup(pinfo->pool, tvb, 0, len); bitswap_buf_inplace(datax, len); diff --git a/epan/dissectors/packet-m2pa.c b/epan/dissectors/packet-m2pa.c index 69b4c23d7c..e26b8c8aed 100644 --- a/epan/dissectors/packet-m2pa.c +++ b/epan/dissectors/packet-m2pa.c @@ -228,7 +228,7 @@ dissect_v2_user_data_message(tvbuff_t *message_data_tvb, packet_info *pinfo, pro proto_tree *m2pa_li_tree; tvbuff_t *payload_tvb; - if (tvb_length(message_data_tvb) > 0) { + if (tvb_reported_length(message_data_tvb) > 0) { if (m2pa_tree) { m2pa_li_tree = proto_tree_add_subtree(m2pa_tree, message_data_tvb, LI_OFFSET, LI_LENGTH, ett_m2pa_li, NULL, "Length Indicator"); @@ -253,7 +253,7 @@ dissect_v8_user_data_message(tvbuff_t *message_data_tvb, packet_info *pinfo, pro proto_tree *m2pa_li_tree; tvbuff_t *payload_tvb; - if (tvb_length(message_data_tvb) > 0) { + if (tvb_reported_length(message_data_tvb) > 0) { if (m2pa_tree) { m2pa_li_tree = proto_tree_add_subtree(m2pa_tree, message_data_tvb, LI_OFFSET, LI_LENGTH, ett_m2pa_li, NULL, "Length Indicator"); proto_tree_add_item(m2pa_li_tree, hf_v8_li_prio, message_data_tvb, LI_OFFSET, LI_LENGTH, ENC_BIG_ENDIAN); @@ -280,7 +280,7 @@ dissect_user_data_message(tvbuff_t *message_data_tvb, packet_info *pinfo, proto_ proto_tree *m2pa_li_tree; tvbuff_t *payload_tvb; - if (tvb_length(message_data_tvb) > 0) { + if (tvb_reported_length(message_data_tvb) > 0) { if (m2pa_tree) { m2pa_li_tree = proto_tree_add_subtree(m2pa_tree, message_data_tvb, PRI_OFFSET, PRI_LENGTH, ett_m2pa_li, NULL, "Priority"); proto_tree_add_item(m2pa_li_tree, hf_pri_prio, message_data_tvb, PRI_OFFSET, PRI_LENGTH, ENC_BIG_ENDIAN); @@ -333,7 +333,7 @@ dissect_v8_link_status_message(tvbuff_t *message_data_tvb, packet_info *pinfo, p col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), v8_link_status_values, "Unknown")); - filler_length = tvb_length(message_data_tvb) - STATUS_LENGTH; + filler_length = tvb_reported_length(message_data_tvb) - STATUS_LENGTH; proto_tree_add_item(m2pa_tree, hf_v8_status, message_data_tvb, STATUS_OFFSET, STATUS_LENGTH, ENC_BIG_ENDIAN); if (filler_length > 0) @@ -359,7 +359,7 @@ dissect_link_status_message(tvbuff_t *message_data_tvb, packet_info *pinfo, prot col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), link_status_values, "Unknown")); - filler_length = tvb_length(message_data_tvb) - STATUS_LENGTH; + filler_length = tvb_reported_length(message_data_tvb) - STATUS_LENGTH; proto_tree_add_item(m2pa_tree, hf_status, message_data_tvb, STATUS_OFFSET, STATUS_LENGTH, ENC_BIG_ENDIAN); if (filler_length > 0) @@ -371,7 +371,7 @@ dissect_unknown_message(tvbuff_t *message_data_tvb, proto_tree *m2pa_tree) { guint length; - length = tvb_length(message_data_tvb); + length = tvb_reported_length(message_data_tvb); if ((m2pa_tree) && (length > 0)) proto_tree_add_item(m2pa_tree, hf_unknown_data, message_data_tvb, 0, length, ENC_NA); } diff --git a/epan/dissectors/packet-m2ua.c b/epan/dissectors/packet-m2ua.c index 51b91fbb46..3160b3bde6 100644 --- a/epan/dissectors/packet-m2ua.c +++ b/epan/dissectors/packet-m2ua.c @@ -885,7 +885,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); /* calculate padding and total length */ - 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(m2ua_tree, parameter_tvb, PARAMETER_HEADER_OFFSET, -1, diff --git a/epan/dissectors/packet-m3ua.c b/epan/dissectors/packet-m3ua.c index 81b567bcda..b01b3d06d1 100644 --- a/epan/dissectors/packet-m3ua.c +++ b/epan/dissectors/packet-m3ua.c @@ -1390,7 +1390,7 @@ dissect_v5_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; if (!tree && tag != V5_PROTOCOL_DATA_PARAMETER_TAG) return; /* Nothing to do here */ @@ -1517,7 +1517,7 @@ dissect_v6_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; if (!tree && tag != V6_PROTOCOL_DATA_1_PARAMETER_TAG && tag != V6_PROTOCOL_DATA_2_PARAMETER_TAG) return; /* Nothing to do here */ @@ -1684,7 +1684,7 @@ dissect_v7_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; if (!tree && tag != V7_PROTOCOL_DATA_1_PARAMETER_TAG && tag != V7_PROTOCOL_DATA_2_PARAMETER_TAG) return; /* Nothing to do here */ @@ -1850,7 +1850,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; if (!tree && tag != PROTOCOL_DATA_PARAMETER_TAG) @@ -1956,7 +1956,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-mac-lte-framed.c b/epan/dissectors/packet-mac-lte-framed.c index 5d17be1276..4d7ab4cc2b 100644 --- a/epan/dissectors/packet-mac-lte-framed.c +++ b/epan/dissectors/packet-mac-lte-framed.c @@ -56,7 +56,7 @@ static void dissect_mac_lte_framed(tvbuff_t *tvb, packet_info *pinfo, - fixed header bytes - tag for data - at least one byte of MAC PDU payload */ - if ((size_t)tvb_length_remaining(tvb, offset) < (3+2)) { + if ((size_t)tvb_reported_length_remaining(tvb, offset) < (3+2)) { return; } diff --git a/epan/dissectors/packet-media.c b/epan/dissectors/packet-media.c index 798e1386a8..1305b345d3 100644 --- a/epan/dissectors/packet-media.c +++ b/epan/dissectors/packet-media.c @@ -50,14 +50,14 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data) heur_dtbl_entry_t *hdtbl_entry; if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree, &hdtbl_entry, data)) { - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* Add media type to the INFO column if it is visible */ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", (pinfo->match_string) ? pinfo->match_string : ""); if (tree) { - if ( (bytes = tvb_length(tvb)) > 0 ) + if ( (bytes = tvb_reported_length(tvb)) > 0 ) { ti = proto_tree_add_item(tree, proto_media, tvb, 0, -1, ENC_NA); media_tree = proto_item_add_subtree(ti, ett_media); @@ -78,7 +78,7 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data) } } - return tvb_length(tvb); + return tvb_reported_length(tvb); } void diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c index a8522c843d..5906c43043 100644 --- a/epan/dissectors/packet-mgcp.c +++ b/epan/dissectors/packet-mgcp.c @@ -341,7 +341,7 @@ static int dissect_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Initialize variables */ tvb_sectionend = 0; tvb_sectionbegin = tvb_sectionend; - tvb_len = tvb_length(tvb); + tvb_len = tvb_reported_length(tvb); num_messages = 0; mgcp_tree = NULL; ti = NULL; @@ -450,7 +450,7 @@ static int dissect_tpkt_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree * Dissect ASCII TPKT header */ dissect_asciitpkt(tvb, pinfo, tree, mgcp_handle); - offset = tvb_length(tvb); + offset = tvb_reported_length(tvb); } return offset; @@ -496,7 +496,7 @@ static void dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree * mi->hasDigitMap = FALSE; /* Initialize variables */ - tvb_len = tvb_length(tvb); + tvb_len = tvb_reported_length(tvb); /* * Check to see whether we're really dealing with MGCP by looking @@ -562,7 +562,7 @@ static void mgcp_raw_text_add(tvbuff_t *tvb, proto_tree *tree) gint tvb_linebegin,tvb_lineend,tvb_len,linelen; tvb_linebegin = 0; - tvb_len = tvb_length(tvb); + tvb_len = tvb_reported_length(tvb); do { @@ -1036,7 +1036,7 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb, packet_info *pinfo, proto_tree static address null_address = { AT_NONE, -1, 0, NULL }; tvb_previous_offset = 0; - tvb_len = tvb_length(tvb); + tvb_len = tvb_reported_length(tvb); tvb_current_offset = tvb_previous_offset; mi->is_duplicate = FALSE; mi->request_available = FALSE; @@ -1047,7 +1047,7 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb, packet_info *pinfo, proto_tree do { - tvb_current_len = tvb_length_remaining(tvb,tvb_previous_offset); + tvb_current_len = tvb_reported_length_remaining(tvb,tvb_previous_offset); tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset, tvb_current_len, ' '); if (tvb_current_offset == -1) { @@ -1409,7 +1409,7 @@ static void dissect_mgcp_params(tvbuff_t *tvb, proto_tree *tree) gint tvb_tokenbegin; proto_tree *mgcp_param_ti, *mgcp_param_tree; - tvb_len = tvb_length(tvb); + tvb_len = tvb_reported_length(tvb); tvb_linebegin = 0; tvb_lineend = tvb_linebegin; @@ -1777,7 +1777,7 @@ static gint tvb_find_null_line(tvbuff_t* tvb, gint offset, gint len, gint* next_ } else { - tvb_current_len = tvb_length_remaining(tvb,offset); + tvb_current_len = tvb_reported_length_remaining(tvb,offset); } maxoffset = (tvb_current_len - 1) + offset; @@ -1787,7 +1787,7 @@ static gint tvb_find_null_line(tvbuff_t* tvb, gint offset, gint len, gint* next_ do { tvb_linebegin = tvb_lineend; - tvb_current_len = tvb_length_remaining(tvb,tvb_linebegin); + tvb_current_len = tvb_reported_length_remaining(tvb,tvb_linebegin); tvb_find_line_end(tvb, tvb_linebegin, tvb_current_len, &tvb_lineend,FALSE); tempchar = tvb_get_guint8(tvb,tvb_linebegin); } while (tempchar != '\r' && tempchar != '\n' && tvb_lineend <= maxoffset); @@ -1833,7 +1833,7 @@ static gint tvb_find_dot_line(tvbuff_t* tvb, gint offset, gint len, gint* next_o gint tvb_current_offset, tvb_current_len, maxoffset,tvb_len; guint8 tempchar; tvb_current_len = len; - tvb_len = tvb_length(tvb); + tvb_len = tvb_reported_length(tvb); if (len == -1) { diff --git a/epan/dissectors/packet-mp4ves.c b/epan/dissectors/packet-mp4ves.c index d65c2bd941..72caaf2c5a 100644 --- a/epan/dissectors/packet-mp4ves.c +++ b/epan/dissectors/packet-mp4ves.c @@ -599,7 +599,7 @@ dissect_mp4ves_VisualObject(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bit_offset+=24; proto_tree_add_bits_item(tree, hf_mp4ves_start_code, tvb, bit_offset, 8, ENC_BIG_ENDIAN); bit_offset+= 8; - if(tvb_length_remaining(tvb,(bit_offset>>3))<=0){ + if(tvb_reported_length_remaining(tvb,(bit_offset>>3))<=0){ proto_tree_add_expert(tree, pinfo, &ei_mp4ves_config_too_short, tvb, 0, -1); return -1; } @@ -746,7 +746,7 @@ dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ - if (tvb_length(tvb)< 4){ + if (tvb_reported_length(tvb)< 4){ /* To short to be a start code */ proto_tree_add_item(mp4ves_tree, hf_mp4ves_data, tvb, bit_offset>>3, -1, ENC_NA); return; @@ -846,7 +846,7 @@ dissect_mp4ves_par_decoderConfigurationInformation(tvbuff_t *tvb, packet_info *p dissect_mp4ves_config(tvb, pinfo, tree); - return tvb_length(tvb); + return tvb_reported_length(tvb); } typedef struct _mp4ves_capability_t { @@ -897,7 +897,7 @@ dissect_mp4ves_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, voi } } - return tvb_length(tvb); + return tvb_reported_length(tvb); } void diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index 77ecf0e0c2..249e6350a2 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -135,7 +135,7 @@ dissect_mtp2_header(tvbuff_t *su_tvb, proto_item *mtp2_tree) static guint16 mtp2_fcs16(tvbuff_t * tvbuff) { - guint len = tvb_length(tvbuff)-2; + guint len = tvb_reported_length(tvbuff)-2; /* Check for Invalid Length */ if (len == 0) @@ -160,7 +160,7 @@ mtp2_decode_crc16(tvbuff_t *tvb, proto_tree *fh_tree, packet_info *pinfo) /* * Do we have the entire packet, and does it include a 2-byte FCS? */ - len = tvb_length_remaining(tvb, proto_offset); + len = tvb_reported_length_remaining(tvb, proto_offset); reported_len = tvb_reported_length_remaining(tvb, proto_offset); if (reported_len < 2 || len < 0) { /* @@ -280,10 +280,10 @@ dissect_mtp2_msu(tvbuff_t *su_tvb, packet_info *pinfo, proto_item *mtp2_item, pr col_set_str(pinfo->cinfo, COL_INFO, "MSU "); if (use_extended_sequence_numbers) { - sif_sio_length = tvb_length(su_tvb) - EXTENDED_HEADER_LENGTH; + sif_sio_length = tvb_reported_length(su_tvb) - EXTENDED_HEADER_LENGTH; sif_sio_tvb = tvb_new_subset_length(su_tvb, EXTENDED_SIO_OFFSET, sif_sio_length); } else { - sif_sio_length = tvb_length(su_tvb) - HEADER_LENGTH; + sif_sio_length = tvb_reported_length(su_tvb) - HEADER_LENGTH; sif_sio_tvb = tvb_new_subset_length(su_tvb, SIO_OFFSET, sif_sio_length); } call_dissector(mtp3_handle, sif_sio_tvb, pinfo, tree); diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index b2966e560e..f6b18206c6 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -762,7 +762,7 @@ dissect_mtp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) memcpy(&(tap_rec->addr_dpc), mtp3_addr_dpc, sizeof(mtp3_addr_pc_t)); tap_rec->si_code = (tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK); - tap_rec->size = tvb_length(tvb); + tap_rec->size = tvb_reported_length(tvb); tap_queue_packet(mtp3_tap, pinfo, tap_rec); diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c index 1a6fe60e54..4e6c20b2e8 100644 --- a/epan/dissectors/packet-multipart.c +++ b/epan/dissectors/packet-multipart.c @@ -185,7 +185,7 @@ base64_decode(packet_info *pinfo, tvbuff_t *b64_tvb, char *name) { char *data; tvbuff_t *tvb; - data = tvb_get_string_enc(wmem_packet_scope(), b64_tvb, 0, tvb_length(b64_tvb), ENC_ASCII); + data = tvb_get_string_enc(wmem_packet_scope(), b64_tvb, 0, tvb_reported_length(b64_tvb), ENC_ASCII); tvb = base64_to_tvb(b64_tvb, data); add_new_data_source(pinfo, tvb, name); @@ -456,13 +456,13 @@ find_first_boundary(tvbuff_t *tvb, gint start, const guint8 *boundary, { gint offset = start, next_offset, line_len, boundary_start; - while (tvb_length_remaining(tvb, offset + 2 + boundary_len) > 0) { + while (tvb_reported_length_remaining(tvb, offset + 2 + boundary_len) > 0) { boundary_start = offset; if (((tvb_strneql(tvb, offset, (const guint8 *)"--", 2) == 0) && (tvb_strneql(tvb, offset + 2, boundary, boundary_len) == 0))) { /* Boundary string; now check if last */ - if ((tvb_length_remaining(tvb, offset + 2 + boundary_len + 2) >= 0) + if ((tvb_reported_length_remaining(tvb, offset + 2 + boundary_len + 2) >= 0) && (tvb_strneql(tvb, offset + 2 + boundary_len, (const guint8 *)"--", 2) == 0)) { *last_boundary = TRUE; @@ -502,7 +502,7 @@ find_next_boundary(tvbuff_t *tvb, gint start, const guint8 *boundary, { gint offset = start, next_offset, line_len, boundary_start; - while (tvb_length_remaining(tvb, offset + 2 + boundary_len) > 0) { + while (tvb_reported_length_remaining(tvb, offset + 2 + boundary_len) > 0) { line_len = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); if (line_len == -1) { return -1; @@ -512,7 +512,7 @@ find_next_boundary(tvbuff_t *tvb, gint start, const guint8 *boundary, && (tvb_strneql(tvb, next_offset + 2, boundary, boundary_len) == 0))) { /* Boundary string; now check if last */ - if ((tvb_length_remaining(tvb, next_offset + 2 + boundary_len + 2) >= 0) + if ((tvb_reported_length_remaining(tvb, next_offset + 2 + boundary_len + 2) >= 0) && (tvb_strneql(tvb, next_offset + 2 + boundary_len, (const guint8 *)"--", 2) == 0)) { *last_boundary = TRUE; @@ -608,7 +608,7 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary, /* Look for the end of the header (denoted by cr) * 3:d argument to imf_find_field_end() maxlen; must be last offset in the tvb. */ - next_offset = imf_find_field_end(tvb, offset, tvb_length_remaining(tvb, offset)+offset, &last_field); + next_offset = imf_find_field_end(tvb, offset, tvb_reported_length_remaining(tvb, offset)+offset, &last_field); /* If cr not found, won't have advanced - get out to avoid infinite loop! */ if (next_offset == offset) { break; @@ -789,7 +789,7 @@ static int dissect_multipart(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree */ proto_tree_add_expert(tree, pinfo, &ei_multipart_no_required_boundary_parameter, tvb, 0, -1); call_dissector(data_handle, tvb, pinfo, tree); - return tvb_length(tvb); + return tvb_reported_length(tvb); } boundary = (guint8 *)m_info->boundary; boundary_len = m_info->boundary_length; @@ -823,7 +823,7 @@ static int dissect_multipart(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree call_dissector(data_handle, tvb, pinfo, subtree); /* Clean up the dynamically allocated memory */ cleanup_multipart_info(m_info); - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* * Process the encapsulated bodies @@ -834,18 +834,18 @@ static int dissect_multipart(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (header_start == -1) { /* Clean up the dynamically allocated memory */ cleanup_multipart_info(m_info); - return tvb_length(tvb); + return tvb_reported_length(tvb); } } /* * Process the multipart trailer */ - if (tvb_length_remaining(tvb, header_start) > 0) { + if (tvb_reported_length_remaining(tvb, header_start) > 0) { proto_tree_add_item(subtree, hf_multipart_trailer, tvb, header_start, -1, ENC_NA); } /* Clean up the dynamically allocated memory */ cleanup_multipart_info(m_info); - return tvb_length(tvb); + return tvb_reported_length(tvb); } /* Returns index of method in multipart_headers */ diff --git a/epan/dissectors/packet-nb_rtpmux.c b/epan/dissectors/packet-nb_rtpmux.c index d18d74af7f..422e7fd538 100644 --- a/epan/dissectors/packet-nb_rtpmux.c +++ b/epan/dissectors/packet-nb_rtpmux.c @@ -78,7 +78,7 @@ dissect_nb_rtpmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat */ /* Check that there's enough data */ - if (tvb_length(tvb) < 6) + if (tvb_captured_length(tvb) < 6) return 0; /* Make entries in Protocol column and Info column on summary display */ @@ -139,7 +139,7 @@ dissect_nb_rtpmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat /* We have an RTP payload. */ if (rtpdissector) { - captured_length = tvb_length_remaining(tvb, offset + 5); + captured_length = tvb_reported_length_remaining(tvb, offset + 5); if (captured_length > (gint)length) captured_length = length; next_tvb = tvb_new_subset(tvb, offset+5, captured_length, @@ -158,7 +158,7 @@ dissect_nb_rtpmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat } /* Return the amount of data this dissector was able to dissect */ - return tvb_length(tvb); + return tvb_reported_length(tvb); } |