diff options
author | Evan Huus <eapache@gmail.com> | 2015-06-23 15:17:27 -0700 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2015-06-23 22:17:56 +0000 |
commit | 0a9a2554a46ce4e040dba669a3ed22f0e9ab709e (patch) | |
tree | 931067907b96dc2f2ad7bf815f28aad90f6a0f6b /epan | |
parent | d4f6480253cf303f70c3d831098adf7582403b8f (diff) |
Remove more deprecated tvb_length calls
Change-Id: Ie137e6f4e20fe26b1a4d9510e267896219c1c631
Reviewed-on: https://code.wireshark.org/review/9075
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
29 files changed, 141 insertions, 148 deletions
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index 3b97ae6612..612ca9a707 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -579,7 +579,7 @@ check_ndmp_rm(tvbuff_t *tvb, packet_info *pinfo) } /* check that the header looks sane */ - len=tvb_length(tvb); + len=tvb_captured_length(tvb); /* check the record marker that it looks sane. * It has to be >=0 bytes or (arbitrary limit) <1Mbyte */ @@ -599,7 +599,7 @@ check_ndmp_hdr(tvbuff_t *tvb ) guint len; guint32 tmp; - len=tvb_length(tvb); + len=tvb_captured_length(tvb); /* If the length is less than 24, it isn't a valid header */ @@ -1357,7 +1357,7 @@ dissect_execute_cdb_cdb(tvbuff_t *tvb, int offset, packet_info *pinfo, tvbuff_t *cdb_tvb; int tvb_len, tvb_rlen; - tvb_len=tvb_length_remaining(tvb, offset); + tvb_len=tvb_captured_length_remaining(tvb, offset); if(tvb_len>16) tvb_len=16; tvb_rlen=tvb_reported_length_remaining(tvb, offset); @@ -1410,7 +1410,7 @@ dissect_execute_cdb_payload(tvbuff_t *tvb, int offset, packet_info *pinfo, proto tvbuff_t *data_tvb; int tvb_len, tvb_rlen; - tvb_len=tvb_length_remaining(tvb, offset); + tvb_len=tvb_captured_length_remaining(tvb, offset); if(tvb_len>(int)payload_len) tvb_len=payload_len; tvb_rlen=tvb_reported_length_remaining(tvb, offset); @@ -2948,7 +2948,7 @@ dissect_ndmp_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree if(ndmp_commands[i].cmd==0){ /* we do not know this message */ expert_add_info(pinfo, msg_item, &ei_ndmp_msg); - offset+=tvb_length_remaining(tvb, offset); + offset+=tvb_captured_length_remaining(tvb, offset); return offset; } @@ -3136,7 +3136,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* frag_msg = fragment_add_seq_check(&ndmp_reassembly_table, tvb, 4, pinfo, seq, NULL, frag_num, - tvb_length_remaining(tvb, offset)-4, + tvb_captured_length_remaining(tvb, offset)-4, !(ndmp_rm & RPC_RM_LASTFRAG)); new_tvb = process_reassembled_data(tvb, 4, pinfo, "Reassembled NDMP", frag_msg, &ndmp_frag_items, NULL, tree); @@ -3183,7 +3183,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* /* size of this NDMP PDU */ - size = tvb_length_remaining(new_tvb, offset); + size = tvb_captured_length_remaining(new_tvb, offset); if (size < 24) { /* too short to be NDMP */ pinfo->fragmented = save_fragmented; @@ -3320,7 +3320,7 @@ check_if_ndmp(tvbuff_t *tvb, packet_info *pinfo) } /* check that the header looks sane */ - len=tvb_length(tvb); + len=tvb_captured_length(tvb); /* check the record marker that it looks sane. * It has to be >=24 bytes or (arbitrary limit) <1Mbyte */ @@ -3402,7 +3402,7 @@ dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) static int dissect_ndmp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (tvb_length(tvb) < 28) + if (tvb_captured_length(tvb) < 28) return 0; if (!check_if_ndmp(tvb, pinfo)) return 0; diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 78d98f11a2..a8565f16cd 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -2026,7 +2026,7 @@ static const value_string ndps_get_resman_session_type_enum[] = { static int align_4(tvbuff_t *tvb, int aoffset) { - if(tvb_length_remaining(tvb, aoffset) > 4 ) + if(tvb_captured_length_remaining(tvb, aoffset) > 4 ) { return (aoffset%4); } @@ -2318,7 +2318,7 @@ objectidentification(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset) break; case 3: /* Object Name */ foffset = ndps_string(tvb, hf_object_name, atree, foffset, NULL); - if (foffset > tvb_length_remaining(tvb, foffset)) { + if (foffset > tvb_captured_length_remaining(tvb, foffset)) { return foffset; } foffset = name_or_id(tvb, atree, foffset); @@ -4362,7 +4362,7 @@ ndps_defrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, spx_info *spx_i */ tid = (pinfo->srcport+pinfo->destport); len = tvb_reported_length(tvb); - if (tvb_length(tvb) >= len) + if (tvb_captured_length(tvb) >= len) { fd_head = fragment_add_seq_next(&ndps_reassembly_table, tvb, 0, pinfo, tid, NULL, len, !spx_info_p->eom); if (fd_head != NULL) @@ -4637,7 +4637,7 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g length = tvb_get_ntohl(tvb, foffset); proto_tree_add_uint(btree, hf_ndps_included_doc_len, tvb, foffset, 4, length); foffset += 4; - length_remaining = tvb_length_remaining(tvb, foffset); + length_remaining = tvb_reported_length_remaining(tvb, foffset); if (length_remaining == -1 || length > (guint32) length_remaining) /* Segmented Data */ { proto_tree_add_item(btree, hf_ndps_data, tvb, foffset, -1, ENC_NA); @@ -6241,7 +6241,7 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g } atree = proto_tree_add_subtree_format(ndps_tree, tvb, foffset, -1, ett_ndps, &aitem, "Item %d", ii+1); length=tvb_get_ntohl(tvb, foffset); - length_remaining = tvb_length_remaining(tvb, foffset); + length_remaining = tvb_reported_length_remaining(tvb, foffset); if(length_remaining == -1 || (guint32) length_remaining < length) { return foffset; @@ -6582,7 +6582,7 @@ ndps_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset foffset += 4; proto_tree_add_item(ndps_tree, hf_ndps_other_error_2, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (tvb_length_remaining(tvb, foffset) >= 4) { + if (tvb_reported_length_remaining(tvb, foffset) >= 4) { foffset = ndps_string(tvb, hf_ndps_other_error_string, ndps_tree, foffset, NULL); } break; @@ -6789,7 +6789,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int request_value->ndps_frame_num); } - if (tvb_length_remaining(tvb, foffset) < 12 && tvb_get_ntohl(tvb, foffset) == 0) /* No error and no return data */ + if (tvb_reported_length_remaining(tvb, foffset) < 12 && tvb_get_ntohl(tvb, foffset) == 0) /* No error and no return data */ { proto_tree_add_uint(ndps_tree, hf_ndps_error_val, tvb, foffset, 4, error_val); col_append_str(pinfo->cinfo, COL_INFO, "- Ok"); @@ -6803,13 +6803,13 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int expert_add_info_format(pinfo, expert_item, &ei_ndps_rpc_acc_stat, "Fault: %s", val_to_str(expert_status, accept_stat, "Unknown NDPS Error (0x%08x)")); } foffset += 4; - if (tvb_length_remaining(tvb,foffset) < 4 ) { + if (tvb_reported_length_remaining(tvb,foffset) < 4 ) { col_append_str(pinfo->cinfo, COL_INFO, "- Error"); return foffset; } proto_tree_add_item(ndps_tree, hf_ndps_rpc_acc_results, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; - if (tvb_length_remaining(tvb,foffset) < 4) { + if (tvb_reported_length_remaining(tvb,foffset) < 4) { col_append_str(pinfo->cinfo, COL_INFO, "- Error"); return foffset; } @@ -6818,7 +6818,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int proto_tree_add_uint(ndps_tree, hf_ndps_error_val, tvb, foffset, 4, error_val); foffset += 4; /* Some functions return an error with no data, 0 is ok */ - if (try_val_to_str_ext(tvb_get_ntohl(tvb, foffset), &ndps_error_types_ext) && tvb_length_remaining(tvb,foffset) < 8 && (tvb_get_ntohl(tvb, foffset)!=0)) + if (try_val_to_str_ext(tvb_get_ntohl(tvb, foffset), &ndps_error_types_ext) && tvb_reported_length_remaining(tvb,foffset) < 8 && (tvb_get_ntohl(tvb, foffset)!=0)) { expert_status = tvb_get_ntohl(tvb, foffset); expert_item = proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); @@ -6838,7 +6838,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int if(error_val != 0) { foffset = ndps_error(tvb, pinfo, ndps_tree, foffset); - if(tvb_length_remaining(tvb, foffset) < 4) + if(tvb_reported_length_remaining(tvb, foffset) < 4) { break; } @@ -6855,7 +6855,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int if(error_val != 0) { foffset = ndps_error(tvb, pinfo, ndps_tree, foffset); - if(tvb_length_remaining(tvb, foffset) < 4) + if(tvb_reported_length_remaining(tvb, foffset) < 4) { break; } @@ -6918,7 +6918,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int } btree = proto_tree_add_subtree_format(atree, tvb, foffset, -1, ett_ndps, &bitem, "Option %d", ii+1); length=tvb_get_ntohl(tvb, foffset); - length_remaining = tvb_length_remaining(tvb, foffset); + length_remaining = tvb_reported_length_remaining(tvb, foffset); if(length_remaining == -1 || (guint32) length_remaining < length) { return foffset; @@ -8009,7 +8009,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int } btree = proto_tree_add_subtree_format(atree, tvb, foffset, -1, ett_ndps, &bitem, "Item %d", ii+1); length=tvb_get_ntohl(tvb, foffset); - length_remaining = tvb_length_remaining(tvb, foffset); + length_remaining = tvb_reported_length_remaining(tvb, foffset); if(length_remaining == -1 || (guint32) length_remaining < length) { return foffset; diff --git a/epan/dissectors/packet-nsip.c b/epan/dissectors/packet-nsip.c index 8c01ab31b2..b853fa1e68 100644 --- a/epan/dissectors/packet-nsip.c +++ b/epan/dissectors/packet-nsip.c @@ -606,7 +606,7 @@ decode_ie(nsip_ie_t *ie, build_info_t *bi) { int org_offset = bi->offset; - if (tvb_length_remaining(bi->tvb, bi->offset) < 1) { + if (tvb_captured_length_remaining(bi->tvb, bi->offset) < 1) { return; } switch (ie->format) { @@ -700,7 +700,7 @@ decode_pdu_ns_unitdata(build_info_t *bi) { call_dissector(bssgp_handle, next_tvb, bi->pinfo, bi->parent_tree); } else { - sdu_length = tvb_length_remaining(bi->tvb, bi->offset); + sdu_length = tvb_captured_length_remaining(bi->tvb, bi->offset); proto_tree_add_bytes_format(bi->nsip_tree, hf_nsip_ns_sdu, bi->tvb, bi->offset, sdu_length, NULL, "NS SDU (%u bytes)", sdu_length); } diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c index c05c1d5d9e..a066d0ca0d 100644 --- a/epan/dissectors/packet-ntlmssp.c +++ b/epan/dissectors/packet-ntlmssp.c @@ -1917,7 +1917,7 @@ dissect_ntlmssp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi guint32 ntlm_signature_size = 8; guint32 ntlm_seq_size = 4; - length = tvb_length (tvb); + length = tvb_captured_length (tvb); /* signature + seq + real payload */ encrypted_block_length = length - ntlm_magic_size; @@ -2349,7 +2349,7 @@ dissect_ntlmssp_payload_only(tvbuff_t *tvb, packet_info *pinfo, _U_ proto_tree * /* the magic ntlm is the identifier of a NTLMSSP packet that's 00 00 00 01 */ - encrypted_block_length = tvb_length (tvb); + encrypted_block_length = tvb_captured_length (tvb); /* signature + seq + real payload */ /* Setup a new tree for the NTLMSSP payload */ @@ -2402,7 +2402,7 @@ dissect_ntlmssp_verf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * guint32 verifier_length; guint32 encrypted_block_length; - verifier_length = tvb_length (tvb); + verifier_length = tvb_captured_length (tvb); encrypted_block_length = verifier_length - 4; if (encrypted_block_length < 12) { @@ -2616,7 +2616,7 @@ wrap_dissect_ntlmssp(tvbuff_t *tvb, int offset, packet_info *pinfo, dissect_ntlmssp(auth_tvb, pinfo, tree); - return tvb_length_remaining(tvb, offset); + return tvb_captured_length_remaining(tvb, offset); } static int diff --git a/epan/dissectors/packet-nwmtp.c b/epan/dissectors/packet-nwmtp.c index aa56d26194..9b4402bb08 100644 --- a/epan/dissectors/packet-nwmtp.c +++ b/epan/dissectors/packet-nwmtp.c @@ -104,7 +104,7 @@ static void dissect_nwmtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } next_tvb = tvb_new_subset_length(tvb, offset + 12, len); - if (tvb_length(next_tvb) > 0) + if (tvb_reported_length(next_tvb) > 0) call_dissector(mtp_handle, next_tvb, pinfo, tree); /* Check for overflows, which probably can't happen, but better * safe than sorry. See diff --git a/epan/dissectors/packet-olsr.c b/epan/dissectors/packet-olsr.c index ddbc401e1d..3bc69521f1 100644 --- a/epan/dissectors/packet-olsr.c +++ b/epan/dissectors/packet-olsr.c @@ -535,13 +535,13 @@ static int dissect_olsr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi guint16 packet_len; /* Does this packet have a valid message type at the beginning? */ - if (tvb_length(tvb) < 4) { + if (tvb_captured_length(tvb) < 4) { col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR Packet, Length: %u Bytes (not enough data in packet)", - tvb_length(tvb)); + tvb_captured_length(tvb)); return 0; /* not enough bytes for the packet length */ } packet_len = tvb_get_ntohs(tvb, 0); - if (packet_len > tvb_length(tvb)) { + if (packet_len > tvb_reported_length(tvb)) { col_add_fstr(pinfo->cinfo, COL_INFO, "OLSR Packet, Length: %u Bytes (not enough data in packet)", packet_len); return 0; } diff --git a/epan/dissectors/packet-omron-fins.c b/epan/dissectors/packet-omron-fins.c index 2dcd75de43..a4eed220df 100644 --- a/epan/dissectors/packet-omron-fins.c +++ b/epan/dissectors/packet-omron-fins.c @@ -1098,7 +1098,7 @@ dissect_omron_fins(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da guint16 command_code; /* Make sure we have enough actual data to do the heuristics checks */ - if(tvb_length(tvb) < 12 ) { + if(tvb_captured_length(tvb) < 12 ) { return 0; } /* Check some bytes to see if it's OMRON */ diff --git a/epan/dissectors/packet-openvpn.c b/epan/dissectors/packet-openvpn.c index 7057109b2a..e5d7228f3e 100644 --- a/epan/dissectors/packet-openvpn.c +++ b/epan/dissectors/packet-openvpn.c @@ -252,7 +252,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp proto_tree_add_item(openvpn_tree, hf_openvpn_hmac, tvb, offset, tls_auth_hmac_size, ENC_NA); offset += tls_auth_hmac_size; - if (tvb_length_remaining(tvb, offset) >= 8) { + if (tvb_reported_length_remaining(tvb, offset) >= 8) { proto_tree_add_item(openvpn_tree, hf_openvpn_pid, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -263,7 +263,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp } } - if (tvb_length_remaining(tvb, offset) >= 1) { + if (tvb_reported_length_remaining(tvb, offset) >= 1) { /* read P_ACK packet-id array length */ gint pid_arraylength = tvb_get_guint8(tvb, offset); gint i; @@ -278,7 +278,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp offset += 4; } - if (tvb_length_remaining(tvb, offset) >= 8) { + if (tvb_reported_length_remaining(tvb, offset) >= 8) { proto_tree_add_item(openvpn_tree, hf_openvpn_rsessionid, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } @@ -288,7 +288,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp /* if we have a P_CONTROL packet */ if (openvpn_opcode != P_ACK_V1) { /* read Message Packet-ID */ - if (tvb_length_remaining(tvb, offset) >= 4) { + if (tvb_reported_length_remaining(tvb, offset) >= 4) { msg_mpid = tvb_get_bits32(tvb, offset*8, 32, ENC_BIG_ENDIAN); proto_tree_add_item(openvpn_tree, hf_openvpn_mpid, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; @@ -297,7 +297,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp } /* if we have more data left, determine what to do */ - msg_length_remaining = tvb_length_remaining(tvb, offset); + msg_length_remaining = tvb_reported_length_remaining(tvb, offset); if (msg_length_remaining == 0) { return tvb_captured_length(tvb); @@ -307,7 +307,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp proto_tree *data_tree; data_tree = proto_tree_add_subtree_format(openvpn_tree, tvb, offset, -1, ett_openvpn_data, NULL, "Data (%d bytes)", - tvb_length_remaining(tvb, offset)); + tvb_captured_length_remaining(tvb, offset)); proto_tree_add_item(data_tree, hf_openvpn_data, tvb, offset, -1, ENC_NA); return tvb_captured_length(tvb); @@ -346,7 +346,7 @@ dissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvp proto_tree *data_tree; data_tree = proto_tree_add_subtree_format(openvpn_tree, tvb, offset, -1, ett_openvpn_data, NULL, "Message fragment (%d bytes)", - tvb_length_remaining(tvb, offset)); + tvb_captured_length_remaining(tvb, offset)); proto_tree_add_item(data_tree, hf_openvpn_fragment_bytes, tvb, offset, -1, ENC_NA); } diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c index 62ec1ca659..ce4154a6ee 100644 --- a/epan/dissectors/packet-openwire.c +++ b/epan/dissectors/packet-openwire.c @@ -574,7 +574,7 @@ detect_protocol_options(tvbuff_t *tvb, packet_info *pinfo, int offset, int iComm However, if the capture is started after the connection initial handshake, it must be deduced in a heuristic way. For the sake of generality, we do not consider the handshake, but only the heuristic way. */ - if (tvb_length_remaining(tvb, offset) >= 12) + if (tvb_captured_length_remaining(tvb, offset) >= 12) { /* Only check commands which start with a "OPENWIRE_TYPE_CACHED" object */ if (iCommand == OPENWIRE_SESSION_INFO @@ -627,7 +627,7 @@ detect_protocol_options(tvbuff_t *tvb, packet_info *pinfo, int offset, int iComm } } else if ((tvb_get_guint8(tvb, 4) == OPENWIRE_KEEP_ALIVE_INFO) - && (tvb_length(tvb) == 11)) + && (tvb_captured_length(tvb) == 11)) { /* If the capture is started after a long-lived connection is started, a keep-alive command of 11 bytes detects tight encoding (not caching stays unknown). @@ -681,7 +681,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o proto_item *boolean_item = NULL; const char *cache_str = ""; - if (type == OPENWIRE_TYPE_CACHED && retrieve_caching(pinfo) == TRUE && tvb_length_remaining(tvb, offset) >= 3) + if (type == OPENWIRE_TYPE_CACHED && retrieve_caching(pinfo) == TRUE && tvb_reported_length_remaining(tvb, offset) >= 3) { guint8 inlined = 0; gint cachedID = 0; @@ -711,7 +711,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o offset += 3; } } - if (nullable == TRUE && (type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED || type == OPENWIRE_COMMAND_INNER) && tvb_length_remaining(tvb, offset) >= 1) + if (nullable == TRUE && (type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED || type == OPENWIRE_COMMAND_INNER) && tvb_reported_length_remaining(tvb, offset) >= 1) { nullable = tvb_get_guint8(tvb, offset + 0) == FALSE ? TRUE : FALSE; if (openwire_verbose_type) @@ -726,7 +726,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o } offset += 1; } - if (type == OPENWIRE_COMMAND_INNER && tvb_length_remaining(tvb, offset) >= 1) + if (type == OPENWIRE_COMMAND_INNER && tvb_reported_length_remaining(tvb, offset) >= 1) { proto_item * inner_item = NULL; proto_tree * object_tree = NULL; @@ -737,7 +737,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o object_tree = proto_item_add_subtree(inner_item, ett_openwire_type); return (1 + dissect_openwire_command(tvb, pinfo, object_tree, offset, parentType)); } - if ((type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED) && tvb_length_remaining(tvb, offset) >= 1) + if ((type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED) && tvb_reported_length_remaining(tvb, offset) >= 1) { type = tvb_get_guint8(tvb, offset + 0); if (openwire_verbose_type) @@ -746,7 +746,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o } offset += 1; } - if (nullable == TRUE && tvb_length_remaining(tvb, offset) >= 1) + if (nullable == TRUE && tvb_reported_length_remaining(tvb, offset) >= 1) { nullable = tvb_get_guint8(tvb, offset + 0) == FALSE ? TRUE : FALSE; if (openwire_verbose_type) @@ -767,48 +767,48 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o { offset += 0; } - else if (type == OPENWIRE_TYPE_INTEGER && tvb_length_remaining(tvb, offset) >= 4) + else if (type == OPENWIRE_TYPE_INTEGER && tvb_reported_length_remaining(tvb, offset) >= 4) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_integer), tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } - else if (type == OPENWIRE_TYPE_SHORT && tvb_length_remaining(tvb, offset) >= 2) + else if (type == OPENWIRE_TYPE_SHORT && tvb_reported_length_remaining(tvb, offset) >= 2) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_short), tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } - else if (type == OPENWIRE_TYPE_LONG && tvb_length_remaining(tvb, offset) >= 8) + else if (type == OPENWIRE_TYPE_LONG && tvb_reported_length_remaining(tvb, offset) >= 8) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_long), tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } - else if (type == OPENWIRE_TYPE_BOOLEAN && tvb_length_remaining(tvb, offset) >= 1) + else if (type == OPENWIRE_TYPE_BOOLEAN && tvb_reported_length_remaining(tvb, offset) >= 1) { boolean_item = proto_tree_add_item(tree, particularize(field, hf_openwire_type_boolean), tvb, offset, 1, ENC_BIG_ENDIAN); validate_boolean(tvb, pinfo, tree, offset, boolean_item); offset += 1; } - else if (type == OPENWIRE_TYPE_BYTE && tvb_length_remaining(tvb, offset) >= 1) + else if (type == OPENWIRE_TYPE_BYTE && tvb_reported_length_remaining(tvb, offset) >= 1) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_byte), tvb, offset, 1, ENC_NA); offset += 1; } - else if (type == OPENWIRE_TYPE_CHAR && tvb_length_remaining(tvb, offset) >= 2) + else if (type == OPENWIRE_TYPE_CHAR && tvb_reported_length_remaining(tvb, offset) >= 2) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_char), tvb, offset, 2, ENC_NA); offset += 2; } - else if (type == OPENWIRE_TYPE_FLOAT && tvb_length_remaining(tvb, offset) >= 4) + else if (type == OPENWIRE_TYPE_FLOAT && tvb_reported_length_remaining(tvb, offset) >= 4) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_float), tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } - else if (type == OPENWIRE_TYPE_DOUBLE && tvb_length_remaining(tvb, offset) >= 8) + else if (type == OPENWIRE_TYPE_DOUBLE && tvb_reported_length_remaining(tvb, offset) >= 8) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_double), tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } - else if (type == OPENWIRE_TYPE_STRING && tvb_length_remaining(tvb, offset) >= 2) + else if (type == OPENWIRE_TYPE_STRING && tvb_reported_length_remaining(tvb, offset) >= 2) { gint iStringLength = 0; iStringLength = tvb_get_ntohs(tvb, offset); @@ -817,13 +817,13 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o proto_tree_add_item(tree, hf_openwire_type_short, tvb, offset, 2, ENC_BIG_ENDIAN); } offset += 2; - if (tvb_length_remaining(tvb, offset) >= iStringLength) + if (tvb_reported_length_remaining(tvb, offset) >= iStringLength) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_string), tvb, offset, iStringLength, ENC_NA); offset += iStringLength; } } - else if (type == OPENWIRE_TYPE_BIG_STRING && tvb_length_remaining(tvb, offset) >= 4) + else if (type == OPENWIRE_TYPE_BIG_STRING && tvb_reported_length_remaining(tvb, offset) >= 4) { gint iStringLength = 0; iStringLength = tvb_get_ntohl(tvb, offset); @@ -832,13 +832,13 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o proto_tree_add_item(tree, hf_openwire_type_integer, tvb, offset, 4, ENC_BIG_ENDIAN); } offset += 4; - if (tvb_length_remaining(tvb, offset) >= iStringLength) + if (tvb_reported_length_remaining(tvb, offset) >= iStringLength) { proto_tree_add_item(tree, particularize(field, hf_openwire_type_string), tvb, offset, iStringLength, ENC_NA); offset += iStringLength; } } - else if (type == OPENWIRE_TYPE_BYTE_ARRAY && tvb_length_remaining(tvb, offset) >= 4) + else if (type == OPENWIRE_TYPE_BYTE_ARRAY && tvb_reported_length_remaining(tvb, offset) >= 4) { gint iArrayLength = 0; iArrayLength = tvb_get_ntohl(tvb, offset); @@ -847,7 +847,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o proto_tree_add_item(tree, hf_openwire_type_integer, tvb, offset, 4, ENC_BIG_ENDIAN); } offset += 4; - if (tvb_length_remaining(tvb, offset) >= iArrayLength) + if (tvb_reported_length_remaining(tvb, offset) >= iArrayLength) { proto_item * array_item = NULL; proto_tree * object_tree = NULL; @@ -890,7 +890,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o offset += iArrayLength; } } - else if (tvb_length_remaining(tvb, offset) >= 1) + else if (tvb_reported_length_remaining(tvb, offset) >= 1) { /* Check for complex types */ proto_tree *object_tree; @@ -901,7 +901,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o object_tree = proto_item_add_subtree(ti, ett_openwire_type); - if (type == OPENWIRE_TYPE_OBJECT_ARRAY && tvb_length_remaining(tvb, offset) >= 2) + if (type == OPENWIRE_TYPE_OBJECT_ARRAY && tvb_reported_length_remaining(tvb, offset) >= 2) { gint iArrayLength; int iArrayItem = 0; @@ -914,13 +914,13 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o offset += 2; for (iArrayItem = 0; iArrayItem < iArrayLength; iArrayItem++) { - if (tvb_length_remaining(tvb, offset) >= 0) + if (tvb_reported_length_remaining(tvb, offset) >= 0) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_none, OPENWIRE_TYPE_NESTED, type, TRUE); } } } - else if (type == OPENWIRE_TYPE_MAP && tvb_length_remaining(tvb, offset) >= 4) + else if (type == OPENWIRE_TYPE_MAP && tvb_reported_length_remaining(tvb, offset) >= 4) { int iMapItem = 0; int iMapLength = 0; @@ -931,7 +931,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o } proto_item_append_text(ti, " (Size : %d)", iMapLength); offset += 4; - for (iMapItem = 0; (iMapItem < iMapLength) && (tvb_length_remaining(tvb, offset) > 0); iMapItem++) + for (iMapItem = 0; (iMapItem < iMapLength) && (tvb_reported_length_remaining(tvb, offset) > 0); iMapItem++) { proto_item * map_entry; proto_tree * entry_tree; @@ -947,7 +947,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o proto_item_set_len(map_entry, offset - entryStartOffset); } } - else if (type == OPENWIRE_TYPE_THROWABLE && tvb_length_remaining(tvb, offset) >= 2) + else if (type == OPENWIRE_TYPE_THROWABLE && tvb_reported_length_remaining(tvb, offset) >= 2) { gint iStackTraceDepth, iStackTraceItem; offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_throwable_class, OPENWIRE_TYPE_STRING, type, TRUE); @@ -968,7 +968,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o element = proto_tree_add_item(object_tree, hf_openwire_throwable_element, tvb, startElementOffset, -1, ENC_NA); element_tree = proto_item_add_subtree(element, ett_openwire_type); - if (tvb_length_remaining(tvb, offset) >= 0) + if (tvb_reported_length_remaining(tvb, offset) >= 0) { offset += dissect_openwire_type(tvb, pinfo, element_tree, offset, hf_openwire_throwable_classname, OPENWIRE_TYPE_STRING, type, TRUE); offset += dissect_openwire_type(tvb, pinfo, element_tree, offset, hf_openwire_throwable_methodname, OPENWIRE_TYPE_STRING, type, TRUE); @@ -980,47 +980,47 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_exceptionresponse_exception, OPENWIRE_TYPE_THROWABLE, type, TRUE); } } - else if (type == OPENWIRE_TYPE_LIST && tvb_length_remaining(tvb, offset) >= 4) + else if (type == OPENWIRE_TYPE_LIST && tvb_reported_length_remaining(tvb, offset) >= 4) { /* TODO (unused) */ } - else if (type == OPENWIRE_CONNECTION_ID && tvb_length_remaining(tvb, offset) >= 1) + else if (type == OPENWIRE_CONNECTION_ID && tvb_reported_length_remaining(tvb, offset) >= 1) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_connectionid_value, OPENWIRE_TYPE_STRING, type, TRUE); } - else if (type == OPENWIRE_SESSION_ID && tvb_length_remaining(tvb, offset) >= 2) + else if (type == OPENWIRE_SESSION_ID && tvb_reported_length_remaining(tvb, offset) >= 2) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_sessionid_connectionid, OPENWIRE_TYPE_STRING, type, TRUE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_sessionid_value, OPENWIRE_TYPE_LONG, type, FALSE); } - else if (type == OPENWIRE_CONSUMER_ID && tvb_length_remaining(tvb, offset) >= 3) + else if (type == OPENWIRE_CONSUMER_ID && tvb_reported_length_remaining(tvb, offset) >= 3) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_consumerid_connectionid, OPENWIRE_TYPE_STRING, type, TRUE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_consumerid_value, OPENWIRE_TYPE_LONG, type, FALSE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_consumerid_sessionid, OPENWIRE_TYPE_LONG, type, FALSE); } - else if (type == OPENWIRE_PRODUCER_ID && tvb_length_remaining(tvb, offset) >= 3) + else if (type == OPENWIRE_PRODUCER_ID && tvb_reported_length_remaining(tvb, offset) >= 3) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_producerid_connectionid, OPENWIRE_TYPE_STRING, type, TRUE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_producerid_value, OPENWIRE_TYPE_LONG, type, FALSE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_producerid_sessionid, OPENWIRE_TYPE_LONG, type, FALSE); } - else if (type == OPENWIRE_BROKER_ID && tvb_length_remaining(tvb, offset) >= 1) + else if (type == OPENWIRE_BROKER_ID && tvb_reported_length_remaining(tvb, offset) >= 1) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_brokerid_value, OPENWIRE_TYPE_STRING, type, TRUE); } - else if (type == OPENWIRE_MESSAGE_ID && tvb_length_remaining(tvb, offset) >= 3) + else if (type == OPENWIRE_MESSAGE_ID && tvb_reported_length_remaining(tvb, offset) >= 3) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_messageid_producerid, OPENWIRE_TYPE_CACHED, type, TRUE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_messageid_producersequenceid, OPENWIRE_TYPE_LONG, type, FALSE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_messageid_brokersequenceid, OPENWIRE_TYPE_LONG, type, FALSE); } - else if (type == OPENWIRE_ACTIVEMQ_LOCAL_TRANSACTION_ID && tvb_length_remaining(tvb, offset) >= 2) + else if (type == OPENWIRE_ACTIVEMQ_LOCAL_TRANSACTION_ID && tvb_reported_length_remaining(tvb, offset) >= 2) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_localtransactionid_value, OPENWIRE_TYPE_LONG, type, FALSE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_localtransactionid_connectionid, OPENWIRE_TYPE_CACHED, type, TRUE); } - else if (type == OPENWIRE_ACTIVEMQ_XA_TRANSACTION_ID && tvb_length_remaining(tvb, offset) >= 3) + else if (type == OPENWIRE_ACTIVEMQ_XA_TRANSACTION_ID && tvb_reported_length_remaining(tvb, offset) >= 3) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_xatransactionid_formatid, OPENWIRE_TYPE_INTEGER, type, FALSE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_xatransactionid_globaltransactionid, OPENWIRE_TYPE_BYTE_ARRAY, type, TRUE); @@ -1030,7 +1030,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o || type == OPENWIRE_ACTIVEMQ_TOPIC || type == OPENWIRE_ACTIVEMQ_TEMP_QUEUE || type == OPENWIRE_ACTIVEMQ_TEMP_TOPIC) - && tvb_length_remaining(tvb, offset) >= 1) + && tvb_reported_length_remaining(tvb, offset) >= 1) { offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_destination_name, OPENWIRE_TYPE_STRING, type, TRUE); } @@ -1077,10 +1077,10 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_brokerintime, OPENWIRE_TYPE_LONG, type, FALSE); offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_brokerouttime, OPENWIRE_TYPE_LONG, type, FALSE); } - else if (tvb_length_remaining(tvb, offset) > 0) + else if (tvb_reported_length_remaining(tvb, offset) > 0) { expert_add_info_format(pinfo, object_tree, &ei_openwire_type_not_supported, "OpenWire type not supported by Wireshark : %d", type); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); } proto_item_set_len(ti, offset - startOffset); @@ -1101,7 +1101,7 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in if (iCommand == OPENWIRE_WIREFORMAT_INFO) { - if (tvb_length_remaining(tvb, offset) >= 17) + if (tvb_reported_length_remaining(tvb, offset) >= 17) { proto_tree_add_item(tree, hf_openwire_wireformatinfo_magic, tvb, offset + 0, 8, ENC_ASCII|ENC_NA); proto_tree_add_item(tree, hf_openwire_wireformatinfo_version, tvb, offset + 8, 4, ENC_BIG_ENDIAN); @@ -1113,7 +1113,7 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in } else { - if (tvb_length_remaining(tvb, offset) >= 5) + if (tvb_reported_length_remaining(tvb, offset) >= 5) { proto_tree_add_item(tree, hf_openwire_command_id, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_openwire_command_response_required, tvb, offset + 4, 1, ENC_BIG_ENDIAN); @@ -1217,7 +1217,7 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in guint8 iTransactionType; offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_transactioninfo_connectionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE); offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_transactioninfo_transactionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE); - if (tvb_length_remaining(tvb, offset) >= 1) + if (tvb_reported_length_remaining(tvb, offset) >= 1) { iTransactionType = tvb_get_guint8(tvb, offset); offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_transactioninfo_type, OPENWIRE_TYPE_BYTE, iCommand, FALSE); @@ -1298,7 +1298,7 @@ dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in { offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_none, iCommand, parentType, FALSE); } - else if (tvb_length_remaining(tvb, offset) > 0) + else if (tvb_reported_length_remaining(tvb, offset) > 0) { expert_add_info_format(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command not supported by Wireshark: %d", iCommand); } @@ -1315,7 +1315,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data col_set_str(pinfo->cinfo, COL_PROTOCOL, "OpenWire"); col_clear(pinfo->cinfo, COL_INFO); - if (tvb_length_remaining(tvb, offset) >= 5) + if (tvb_reported_length_remaining(tvb, offset) >= 5) { guint8 iCommand; proto_tree *openwireroot_tree; @@ -1352,7 +1352,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data offset += 4; offset += dissect_openwire_command(tvb, pinfo, openwireroot_tree, offset, iCommand); - if (tvb_length_remaining(tvb, offset) > 0) + if (tvb_reported_length_remaining(tvb, offset) > 0) { expert_add_info_format(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command fields unknown to Wireshark: %d", iCommand); } @@ -1364,11 +1364,7 @@ dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data static guint get_openwire_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) { - if (tvb_length_remaining(tvb, offset) >= 5) - { - return (tvb_get_ntohl(tvb, offset) + 4); - } - return 0; + return (tvb_get_ntohl(tvb, offset) + 4); } static int @@ -1385,30 +1381,31 @@ dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void conversation_t *conversation; gboolean detected = FALSE; - if (tvb_length(tvb) == 10 || tvb_length(tvb) == 11) + if (tvb_reported_length(tvb) == 10 || tvb_reported_length(tvb) == 11) { /* KeepAlive is sent by default every 30 second. It is 10 bytes (loose) or 11 bytes (tight) long. */ if ((tvb_get_guint8(tvb, 4) == OPENWIRE_KEEP_ALIVE_INFO) - && (tvb_get_ntohl(tvb, 0) + 4 == tvb_length(tvb))) + && (tvb_get_ntohl(tvb, 0) + 4 == tvb_reported_length(tvb))) { detected = TRUE; } } - else if (tvb_length(tvb) == 14 || tvb_length(tvb) == 15) + else if (tvb_reported_length(tvb) == 14 || tvb_reported_length(tvb) == 15) { /* Response is sent after several commands. It is 14 bytes (loose) or 15 bytes (tight) long. */ if ((tvb_get_guint8(tvb, 4) == OPENWIRE_RESPONSE) - && (tvb_get_ntohl(tvb, 0) + 4 == tvb_length(tvb))) + && (tvb_get_ntohl(tvb, 0) + 4 == tvb_reported_length(tvb))) { detected = TRUE; } } - else if (tvb_length(tvb) >= 13) + else if (tvb_reported_length(tvb) >= 13) { /* Only the WIREFORMAT_INFO command contains a "magic". It is the first command sent on a connection. If the capture was started after this command, a manual "Decode As..." might be required. */ - if ((tvb_get_guint8(tvb, 4) == OPENWIRE_WIREFORMAT_INFO) + if (tvb_captured_length(tvb) >= 10 + && (tvb_get_guint8(tvb, 4) == OPENWIRE_WIREFORMAT_INFO) && (tvb_get_ntohl(tvb, 5) == OPENWIRE_MAGIC_PART_1) && (tvb_get_ntohl(tvb, 9) == OPENWIRE_MAGIC_PART_2)) { diff --git a/epan/dissectors/packet-osi.c b/epan/dissectors/packet-osi.c index 8b565225dd..20cce76e6d 100644 --- a/epan/dissectors/packet-osi.c +++ b/epan/dissectors/packet-osi.c @@ -64,7 +64,7 @@ calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) { if ( 0 == checksum ) return( NO_CKSUM ); - available_len = tvb_length_remaining( tvb, offset ); + available_len = tvb_captured_length_remaining( tvb, offset ); if ( available_len < len ) return( DATA_MISSING ); @@ -119,7 +119,7 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in if ( 0 == checksum ) return( NO_CKSUM ); - available_len = tvb_length_remaining( tvb, offset ); + available_len = tvb_captured_length_remaining( tvb, offset ); offset_check -= offset; if ( ( available_len < len ) || ( offset_check < 0 ) || ( (guint)(offset_check+2) > len ) ) return( DATA_MISSING ); diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c index 15db2649a9..1d2769ba18 100644 --- a/epan/dissectors/packet-ositp.c +++ b/epan/dissectors/packet-ositp.c @@ -875,7 +875,7 @@ static int ositp_decode_DR(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, /* User data */ call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); /* we dissected all of the containing PDU */ return offset; @@ -1131,7 +1131,7 @@ static int ositp_decode_DT(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, offset += li; next_tvb = tvb_new_subset_remaining(tvb, offset); - fragment_length = tvb_length(next_tvb); + fragment_length = tvb_captured_length(next_tvb); if (fragment) { col_append_fstr(pinfo->cinfo, COL_INFO, " [COTP fragment, %u byte%s]", fragment_length, plurality(fragment_length, "", "s")); @@ -1203,7 +1203,7 @@ static int ositp_decode_DT(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, } } - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); /* we dissected all of the containing PDU */ return offset; @@ -1405,7 +1405,7 @@ static int ositp_decode_ED(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(data_handle,next_tvb, pinfo, tree); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); /* we dissected all of the containing PDU */ return offset; @@ -1607,7 +1607,7 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, } else call_dissector(data_handle, next_tvb, pinfo, tree); - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); /* we dissected all of the containing PDU */ return offset; @@ -2080,7 +2080,7 @@ static int ositp_decode_UD(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, /*call_dissector(data_handle,next_tvb, pinfo, tree); */ - offset += tvb_length_remaining(tvb, offset); + offset += tvb_captured_length_remaining(tvb, offset); /* we dissected all of the containing PDU */ return offset; diff --git a/epan/dissectors/packet-p_mul.c b/epan/dissectors/packet-p_mul.c index 92d5035fb1..5e936e3c62 100644 --- a/epan/dissectors/packet-p_mul.c +++ b/epan/dissectors/packet-p_mul.c @@ -908,7 +908,7 @@ static int dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v /* Checksum */ en = proto_tree_add_item (p_mul_tree, hf_checksum, tvb, offset, 2, ENC_BIG_ENDIAN); checksum_tree = proto_item_add_subtree (en, ett_checksum); - len = tvb_length (tvb); + len = tvb_captured_length (tvb); value = (guint8 *)tvb_memdup (wmem_packet_scope(), tvb, 0, len); if (len >= offset+2) { value[offset] = 0; @@ -1066,7 +1066,7 @@ static int dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v case Data_PDU: /* Fragment of Data (variable length) */ - data_len = tvb_length_remaining (tvb, offset); + data_len = tvb_captured_length_remaining (tvb, offset); proto_tree_add_none_format (p_mul_tree, hf_data_fragment, tvb, offset, data_len, "Fragment %d of Data (%d byte%s)", seq_no, data_len, @@ -1180,7 +1180,7 @@ static int dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v } proto_item_append_text (ti, ", Count of Ack: %u", count); - if (tvb_length_remaining (tvb, offset) >= 8) { + if (tvb_reported_length_remaining (tvb, offset) >= 8) { /* Timestamp Option (in units of 100ms) */ guint64 timestamp; @@ -1309,7 +1309,7 @@ static int dissect_p_mul (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v proto_item_append_text (len_en, " (incorrect, should be: %d)", offset + data_len); expert_add_info(pinfo, len_en, &ei_length); - } else if ((len = tvb_length_remaining (tvb, pdu_length)) > 0) { + } else if ((len = tvb_reported_length_remaining (tvb, pdu_length)) > 0) { proto_item_append_text (len_en, " (more data in packet: %d)", len); expert_add_info(pinfo, len_en, &ei_more_data); } diff --git a/epan/dissectors/packet-pnrp.c b/epan/dissectors/packet-pnrp.c index 123b4c52e7..13139df190 100644 --- a/epan/dissectors/packet-pnrp.c +++ b/epan/dissectors/packet-pnrp.c @@ -376,11 +376,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi * Validate if it is really a PNRP Packet *----------------------------------------*/ /* Check that there's enough data */ - /* XXX: ISTR that tvb_length should be used when */ - /* initially checking for a valid packet for a */ - /* new style dissector. */ - /* ToDo: confirm */ - data_length = tvb_reported_length(tvb); + data_length = tvb_captured_length(tvb); /* Shortest Message is ACK -> 12 Bytes for Header plus 8 Bytes for Data */ if (data_length < 12+8 ) diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c index e35c22e237..ab48e23b2a 100644 --- a/epan/dissectors/packet-ppi.c +++ b/epan/dissectors/packet-ppi.c @@ -1010,7 +1010,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (ppi_ampdu_reassemble && DOT11N_IS_AGGREGATE(n_ext_flags)) { - len_remain = tvb_length_remaining(tvb, offset); + len_remain = tvb_captured_length_remaining(tvb, offset); #if 0 /* XXX: pad_len never actually used ?? */ if (DOT11N_MORE_AGGREGATES(n_ext_flags)) { pad_len = PADDING4(len_remain); diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 2ad2ba84ad..74c2f6ef05 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -1676,7 +1676,7 @@ static const ip_tcp_opt ipv6cp_opts[] = { static guint16 fcs16(tvbuff_t *tvbuff) { - guint len = tvb_length(tvbuff) - 2; + guint len = tvb_reported_length(tvbuff) - 2; /* Check for Invalid Length */ if (len == 0) @@ -1692,7 +1692,7 @@ fcs16(tvbuff_t *tvbuff) static guint32 fcs32(tvbuff_t *tvbuff) { - guint len = tvb_length(tvbuff) - 4; + guint len = tvb_reported_length(tvbuff) - 4; /* Check for invalid Length */ if (len == 0) @@ -1722,7 +1722,7 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) /* * Do we have the entire packet, and does it include a 2-byte FCS? */ - len = tvb_length_remaining(tvb, proto_offset); + len = tvb_captured_length_remaining(tvb, proto_offset); reported_len = tvb_reported_length_remaining(tvb, proto_offset); if (reported_len < 2 || len < 0) { /* @@ -1774,7 +1774,7 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) /* * Do we have the entire packet, and does it include a 4-byte FCS? */ - len = tvb_length_remaining(tvb, proto_offset); + len = tvb_captured_length_remaining(tvb, proto_offset); reported_len = tvb_reported_length_remaining(tvb, proto_offset); if (reported_len < 4) { /* @@ -4164,7 +4164,7 @@ dissect_bcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (!(flags & BCP_IS_BCONTROL)) { - captured_length = tvb_length_remaining(tvb, offset); + captured_length = tvb_captured_length_remaining(tvb, offset); reported_length = tvb_reported_length_remaining(tvb, offset); pad_length = flags & BCP_PADS_MASK; if (reported_length >= pad_length) { @@ -4935,7 +4935,7 @@ dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) col_set_str(pinfo->cinfo, COL_INFO, "PPP Fragment"); proto_tree_add_item(bs_tree, hf_ppp_hdlc_fragment, tvb, offset, -1, ENC_NA); offset++; - length = tvb_length_remaining(tvb,offset); + length = tvb_captured_length_remaining(tvb,offset); ppp_tvb = remove_escape_chars(tvb, pinfo, offset,length); if (ppp_tvb != NULL) { add_new_data_source(pinfo, ppp_tvb, "PPP Fragment"); @@ -4973,7 +4973,7 @@ dissect_ppp_raw_hdlc( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) col_set_str(pinfo->cinfo, COL_INFO, "PPP Fragment"); proto_tree_add_item(bs_tree, hf_ppp_hdlc_fragment, tvb, offset, -1, ENC_NA); offset++; - length = tvb_length_remaining(tvb, offset); + length = tvb_captured_length_remaining(tvb, offset); ppp_tvb = remove_escape_chars(tvb, pinfo, offset, length); if (ppp_tvb != NULL) { add_new_data_source(pinfo, ppp_tvb, "PPP Fragment"); diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c index 556896b8b7..fb5956a6fb 100644 --- a/epan/dissectors/packet-pppoe.c +++ b/epan/dissectors/packet-pppoe.c @@ -1169,7 +1169,7 @@ static void dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Construct a tvbuff containing the PPP packet. */ - length = tvb_length_remaining(tvb, 6); + length = tvb_captured_length_remaining(tvb, 6); reported_length = tvb_reported_length_remaining(tvb, 6); DISSECTOR_ASSERT(length >= 0); DISSECTOR_ASSERT(reported_length >= 0); diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index ab7fe0a0e4..a6a4f8fdb6 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -3046,7 +3046,7 @@ dissect_ptp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean ptp proto_item *ptp_tlv_period; proto_tree *ptp_tlv_period_tree; - proto_len = tvb_length(tvb); + proto_len = tvb_reported_length(tvb); tlv_offset = PTP_V2_SIG_TLV_START; while (tlv_offset < proto_len) { diff --git a/epan/dissectors/packet-ptpip.c b/epan/dissectors/packet-ptpip.c index 12a1534283..6d8114a6e0 100644 --- a/epan/dissectors/packet-ptpip.c +++ b/epan/dissectors/packet-ptpip.c @@ -552,7 +552,7 @@ int dissect_ptpIP (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da guint32 pktType; /* Check that there's enough data */ - if ( tvb_length_remaining(tvb, offset) < 8 ) /* ptp-photo smallest packet size is 8 */ + if ( tvb_captured_length_remaining(tvb, offset) < 8 ) /* ptp-photo smallest packet size is 8 */ return (0); col_set_str(pinfo->cinfo,COL_PROTOCOL, "PTP/IP"); diff --git a/epan/dissectors/packet-pulse.c b/epan/dissectors/packet-pulse.c index 59b5071e05..5be79fa941 100644 --- a/epan/dissectors/packet-pulse.c +++ b/epan/dissectors/packet-pulse.c @@ -63,7 +63,7 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* const char* magic_str; guint little_endian; - if (tvb_length(tvb) < 4) + if (tvb_captured_length(tvb) < 4) return 0; /* Try to read MAGIC in both endians */ diff --git a/epan/dissectors/packet-pvfs2.c b/epan/dissectors/packet-pvfs2.c index 16b55bc15e..40fcc802dc 100644 --- a/epan/dissectors/packet-pvfs2.c +++ b/epan/dissectors/packet-pvfs2.c @@ -816,7 +816,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset, string_length += 1; } - string_length_captured = tvb_length_remaining(tvb, data_offset); + string_length_captured = tvb_captured_length_remaining(tvb, data_offset); string_length_packet = tvb_reported_length_remaining(tvb, data_offset); /* @@ -850,7 +850,7 @@ dissect_pvfs_opaque_data(tvbuff_t *tvb, int offset, else fill_length = string_length_full - string_length - 4; - fill_length_captured = tvb_length_remaining(tvb, + fill_length_captured = tvb_captured_length_remaining(tvb, data_offset + string_length); fill_length_packet = tvb_reported_length_remaining(tvb, data_offset + string_length); @@ -1507,7 +1507,7 @@ dissect_pvfs2_io_request(tvbuff_t *tvb, proto_tree *tree, int offset, /*offset = */dissect_pvfs_pint_request(tvb, tree, offset); /* TODO: remove this!!! */ - offset = tvb_length(tvb) - 16; + offset = tvb_reported_length(tvb) - 16; /* offset */ proto_tree_add_item(tree, hf_pvfs_offset, tvb, offset, 8, ENC_LITTLE_ENDIAN); @@ -2334,7 +2334,7 @@ dissect_pvfs2_getconfig_response(tvbuff_t *tvb, proto_tree *parent_tree, ptr = tvb_get_ptr(tvb, offset, total_config_bytes); /* Check if all data is available */ - length_remaining = tvb_length_remaining(tvb, offset); + length_remaining = tvb_captured_length_remaining(tvb, offset); if (length_remaining < total_config_bytes) { diff --git a/epan/dissectors/packet-q931.c b/epan/dissectors/packet-q931.c index a8a2feb882..96024e6262 100644 --- a/epan/dissectors/packet-q931.c +++ b/epan/dissectors/packet-q931.c @@ -2748,7 +2748,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, * to the actual size in the frame */ if (!pinfo->can_desegment) { - info_element_len = MIN(info_element_len, tvb_length_remaining(tvb, offset + 3)); + info_element_len = MIN(info_element_len, tvb_captured_length_remaining(tvb, offset + 3)); } /* * Do we have a handle for the H.225 @@ -3109,7 +3109,7 @@ dissect_q931_tpkt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * is one, and that the code put a TPKT header in one * segment and the rest of the PDU in another. */ - if (tvb_length(tvb) == 4) { + if (tvb_reported_length(tvb) == 4) { /* * It is - call the "dissect TPKT over a TCP stream" * routine. diff --git a/epan/dissectors/packet-quake2.c b/epan/dissectors/packet-quake2.c index 61a6019e64..e6f02c2083 100644 --- a/epan/dissectors/packet-quake2.c +++ b/epan/dissectors/packet-quake2.c @@ -105,7 +105,7 @@ dissect_quake2_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo _U_, /* all the rest of the packet is just text */ offset = 4; - len = tvb_length_remaining(tvb, offset); + len = tvb_captured_length_remaining(tvb, offset); text = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len, ENC_ASCII); proto_tree_add_string(cl_tree, hf_quake2_connectionless_text, tvb, offset, len, text); diff --git a/epan/dissectors/packet-quake3.c b/epan/dissectors/packet-quake3.c index f25e0cadcf..f1c7838bdb 100644 --- a/epan/dissectors/packet-quake3.c +++ b/epan/dissectors/packet-quake3.c @@ -251,7 +251,7 @@ dissect_quake3_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo _U_, \ with "<DATA>". */ if (text_item) { /* first correct the length until the end of the packet */ - proto_item_set_len(text_item, tvb_length_remaining(tvb, offset)); + proto_item_set_len(text_item, tvb_captured_length_remaining(tvb, offset)); /* then replace the text */ proto_item_set_text(text_item, "Text: getserversResponse<DATA>"); } diff --git a/epan/dissectors/packet-quic.c b/epan/dissectors/packet-quic.c index 6ce1371415..41999a27e4 100644 --- a/epan/dissectors/packet-quic.c +++ b/epan/dissectors/packet-quic.c @@ -106,7 +106,7 @@ dissect_quic_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 puflags, len_cid, len_seq; guint64 cid, seq; - if (tvb_length(tvb) < QUIC_MIN_LENGTH) + if (tvb_captured_length(tvb) < QUIC_MIN_LENGTH) return 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUIC"); diff --git a/epan/dissectors/packet-scop.c b/epan/dissectors/packet-scop.c index 35748f37dd..fd82703903 100644 --- a/epan/dissectors/packet-scop.c +++ b/epan/dissectors/packet-scop.c @@ -156,7 +156,7 @@ dissect_scop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ col_clear(pinfo->cinfo, COL_INFO); /* Create the protocol display tree. */ - proto_root = proto_tree_add_protocol_format(tree, proto_scop, tvb, 0, tvb_length(tvb), + proto_root = proto_tree_add_protocol_format(tree, proto_scop, tvb, 0, tvb_captured_length(tvb), "ZigBee SCoP"); scop_tree = proto_item_add_subtree(proto_root, ett_scop); @@ -285,7 +285,7 @@ dissect_scop_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* If there are any bytes left over, pass them to the data dissector. */ - if (offset < tvb_length(tvb)) { + if (offset < tvb_reported_length(tvb)) { tvbuff_t *payload_tvb = tvb_new_subset_remaining(tvb, offset); proto_tree *root = proto_tree_get_root(tree); call_dissector(data_handle, payload_tvb, pinfo, root); diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c index 4091ce72ba..5b5d54603f 100644 --- a/epan/dissectors/packet-scsi-osd.c +++ b/epan/dissectors/packet-scsi-osd.c @@ -509,7 +509,7 @@ dissect_osd_attributes_list(packet_info *pinfo, tvbuff_t *tvb, int offset, * all remaining bytes. 7.1.3.1 */ if (!osd2 && type == 1) { - length = tvb_length_remaining(tvb, offset); + length = tvb_reported_length_remaining(tvb, offset); } length += (osd2?8:4); @@ -1592,7 +1592,7 @@ dissect_osd_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); allocation_length = cdata->itlq->alloc_len; - remaining_length = tvb_length_remaining(tvb, offset); + remaining_length = tvb_captured_length_remaining(tvb, offset); if (remaining_length<allocation_length) allocation_length = remaining_length; if (allocation_length<24) return; @@ -3141,7 +3141,7 @@ dissect_osd2_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_osd_attribute_data_in(pinfo, tvb, offset, tree, cdata, lun_info); allocation_length = cdata->itlq->alloc_len; - remaining_length = tvb_length_remaining(tvb, offset); + remaining_length = tvb_captured_length_remaining(tvb, offset); if (remaining_length<allocation_length) allocation_length = remaining_length; if (allocation_length<12) return; diff --git a/epan/dissectors/packet-sebek.c b/epan/dissectors/packet-sebek.c index deba4d5bb7..1fda410216 100644 --- a/epan/dissectors/packet-sebek.c +++ b/epan/dissectors/packet-sebek.c @@ -127,7 +127,7 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U col_set_str(pinfo->cinfo, COL_INFO, "SEBEK - "); - if (tvb_length(tvb)<6) + if (tvb_captured_length(tvb)<6) sebek_ver = 0; else sebek_ver = tvb_get_ntohs(tvb, 4); @@ -156,7 +156,7 @@ dissect_sebek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U sebek_tree = proto_item_add_subtree(ti, ett_sebek); /* check for minimum length before deciding where to go*/ - if (tvb_length(tvb)<6) + if (tvb_captured_length(tvb)<6) sebek_ver = 0; else sebek_ver = tvb_get_ntohs(tvb, 4); diff --git a/epan/dissectors/packet-sigcomp.c b/epan/dissectors/packet-sigcomp.c index 299df01f20..eaec708592 100644 --- a/epan/dissectors/packet-sigcomp.c +++ b/epan/dissectors/packet-sigcomp.c @@ -4465,7 +4465,7 @@ dissect_sigcomp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *_ col_clear(pinfo->cinfo, COL_INFO); - length = tvb_length_remaining(tvb,offset); + length = tvb_captured_length_remaining(tvb,offset); try_again: /* create display subtree for the protocol */ @@ -4498,7 +4498,7 @@ try_again: if (udvm_print_detail_level>2) proto_tree_add_text(sigcomp_tree, tvb, offset, 2, " Illegal escape code"); - offset = offset + tvb_length_remaining(tvb,offset); + offset += tvb_captured_length_remaining(tvb,offset); return offset; } if ( octet == 0xff) { @@ -4818,7 +4818,7 @@ dissect_sigcomp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sigcomp_tr if ( decomp_tvb ) { proto_item *ti; guint32 compression_ratio = - (guint32)(((float)tvb_length(decomp_tvb) / (float)tvb_length(tvb)) * 100); + (guint32)(((float)tvb_reported_length(decomp_tvb) / (float)tvb_reported_length(tvb)) * 100); /* Show compression ratio achieved */ ti = proto_tree_add_uint(sigcomp_tree, hf_sigcomp_compression_ratio, decomp_tvb, @@ -4951,7 +4951,7 @@ dissect_sigcomp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sigcomp_tr if ( decomp_tvb ) { proto_item *ti; guint32 compression_ratio = - (guint32)(((float)tvb_length(decomp_tvb) / (float)tvb_length(tvb)) * 100); + (guint32)(((float)tvb_reported_length(decomp_tvb) / (float)tvb_reported_length(tvb)) * 100); /* Show compression ratio achieved */ ti = proto_tree_add_uint(sigcomp_tree, hf_sigcomp_compression_ratio, decomp_tvb, diff --git a/epan/dissectors/packet-ymsg.c b/epan/dissectors/packet-ymsg.c index 314dbabcf2..7019661930 100644 --- a/epan/dissectors/packet-ymsg.c +++ b/epan/dissectors/packet-ymsg.c @@ -475,7 +475,7 @@ dissect_ymsg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data static gboolean dissect_ymsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - if (tvb_length(tvb) < 4) { + if (tvb_captured_length(tvb) < 4) { return FALSE; } if (tvb_memeql(tvb, 0, "YMSG", 4) == -1) { |