replace another bunch of deprecated tvb_length calls
Change-Id: Ib7c50b55942220d48de025642154b4bf3f39c8a2 Reviewed-on: https://code.wireshark.org/review/9074 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
parent
99ab5c9d38
commit
e53337accf
|
@ -1992,7 +1992,7 @@ static guint32 dissect_trunkcall_ts(tvbuff_t *tvb, guint32 offset, proto_tree *i
|
|||
*scallno = tvb_get_ntohs(tvb, offset + 2);
|
||||
ts = tvb_get_ntohs(tvb, offset + 4);
|
||||
|
||||
rlen = MIN(tvb_length(tvb) - offset - 6, datalen);
|
||||
rlen = MIN(tvb_captured_length(tvb) - offset - 6, datalen);
|
||||
|
||||
if (iax2_tree) {
|
||||
call_tree = proto_tree_add_subtree_format(iax2_tree, tvb, offset, rlen + 6,
|
||||
|
@ -2024,7 +2024,7 @@ static guint32 dissect_trunkcall_nots(tvbuff_t *tvb, guint32 offset, proto_tree
|
|||
*scallno = tvb_get_ntohs(tvb, offset);
|
||||
datalen = tvb_get_ntohs(tvb, offset + 2);
|
||||
|
||||
rlen = MIN(tvb_length(tvb) - offset - 4, datalen);
|
||||
rlen = MIN(tvb_captured_length(tvb) - offset - 4, datalen);
|
||||
|
||||
if (iax2_tree) {
|
||||
call_tree = proto_tree_add_subtree_format(iax2_tree, tvb, offset, rlen + 6,
|
||||
|
@ -2123,7 +2123,7 @@ static guint32 dissect_trunkpacket(tvbuff_t *tvb, guint32 offset,
|
|||
|
||||
if (trunkts) {
|
||||
/* Trunk calls with timestamp */
|
||||
while(tvb_length_remaining(tvb, offset) >= 6) {
|
||||
while(tvb_captured_length_remaining(tvb, offset) >= 6) {
|
||||
guint16 scallno;
|
||||
offset = dissect_trunkcall_ts(tvb, offset, iax2_tree, &scallno);
|
||||
if (!call_list_find(calls, scallno)) {
|
||||
|
@ -2134,7 +2134,7 @@ static guint32 dissect_trunkpacket(tvbuff_t *tvb, guint32 offset,
|
|||
}
|
||||
else {
|
||||
/* Trunk calls without timestamp */
|
||||
while(tvb_length_remaining(tvb, offset) >= 4) {
|
||||
while(tvb_captured_length_remaining(tvb, offset) >= 4) {
|
||||
guint16 scallno;
|
||||
offset = dissect_trunkcall_nots(tvb, offset, iax2_tree, &scallno);
|
||||
if (!call_list_find(calls, scallno)) {
|
||||
|
|
|
@ -1071,7 +1071,7 @@ dissect_icqv5Client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
tvbuff_t *decr_tvb;
|
||||
|
||||
pktsize = tvb_reported_length(tvb);
|
||||
capturedsize = tvb_length(tvb);
|
||||
capturedsize = tvb_captured_length(tvb);
|
||||
|
||||
/* Get the encryption key */
|
||||
code = tvb_get_letohl(tvb, ICQ5_CL_CHECKCODE);
|
||||
|
@ -1278,7 +1278,7 @@ dissect_icq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
proto_tree_add_item(icq_tree, hf_icq_version, tvb, ICQ_VERSION, 2, ENC_LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
return (tvb_length(tvb));
|
||||
return (tvb_captured_length(tvb));
|
||||
}
|
||||
|
||||
/* registration with the filtering engine */
|
||||
|
|
|
@ -3793,7 +3793,7 @@ dissect_17221_aem(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|||
|
||||
default:
|
||||
proto_tree_add_item(aem_tree, hf_aem_unknown_descriptor, tvb,
|
||||
4, tvb_length(tvb) - 4, ENC_NA);
|
||||
4, tvb_captured_length(tvb) - 4, ENC_NA);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -506,14 +506,14 @@ dissect_ieee802154_nonask_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
|
|||
|
||||
/* Create the protocol tree. */
|
||||
if (tree) {
|
||||
proto_root = proto_tree_add_protocol_format(tree, proto_ieee802154_nonask_phy, tvb, 0, tvb_length(tvb), "IEEE 802.15.4 non-ASK PHY");
|
||||
proto_root = proto_tree_add_protocol_format(tree, proto_ieee802154_nonask_phy, tvb, 0, tvb_captured_length(tvb), "IEEE 802.15.4 non-ASK PHY");
|
||||
ieee802154_tree = proto_item_add_subtree(proto_root, ett_ieee802154_nonask_phy);
|
||||
}
|
||||
|
||||
/* Add the protocol name. */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE 802.15.4 non-ASK PHY");
|
||||
/* Add the packet length. */
|
||||
col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_length(tvb));
|
||||
col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_captured_length(tvb));
|
||||
|
||||
phr=tvb_get_guint8(tvb,offset+4+1);
|
||||
|
||||
|
@ -673,13 +673,13 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
|
|||
|
||||
/* Create the protocol tree. */
|
||||
if (tree) {
|
||||
proto_root = proto_tree_add_protocol_format(tree, proto_ieee802154, tvb, 0, tvb_length(tvb), "IEEE 802.15.4");
|
||||
proto_root = proto_tree_add_protocol_format(tree, proto_ieee802154, tvb, 0, tvb_captured_length(tvb), "IEEE 802.15.4");
|
||||
ieee802154_tree = proto_item_add_subtree(proto_root, ett_ieee802154);
|
||||
}
|
||||
/* Add the protocol name. */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IEEE 802.15.4");
|
||||
/* Add the packet length. */
|
||||
col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_length(tvb));
|
||||
col_add_fstr(pinfo->cinfo, COL_PACKET_LENGTH, "%i", tvb_captured_length(tvb));
|
||||
|
||||
/* Add the packet length to the filter field */
|
||||
hidden_item = proto_tree_add_uint(ieee802154_tree, hf_ieee802154_frame_length, NULL, 0, 0, tvb_reported_length(tvb));
|
||||
|
@ -1038,7 +1038,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
|
|||
if (!payload_tvb) {
|
||||
/* Deal with possible truncation and the FCS field at the end. */
|
||||
gint reported_len = tvb_reported_length(tvb)-offset-IEEE802154_FCS_LEN;
|
||||
gint captured_len = tvb_length(tvb)-offset;
|
||||
gint captured_len = tvb_captured_length(tvb)-offset;
|
||||
if (reported_len < captured_len) captured_len = reported_len;
|
||||
payload_tvb = tvb_new_subset(tvb, offset, captured_len, reported_len);
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
|
|||
else {
|
||||
/* Deal with possible truncation and the FCS field at the end. */
|
||||
gint reported_len = tvb_reported_length(tvb)-offset-IEEE802154_FCS_LEN;
|
||||
gint captured_len = tvb_length(tvb)-offset;
|
||||
gint captured_len = tvb_captured_length(tvb)-offset;
|
||||
if (reported_len < captured_len) captured_len = reported_len;
|
||||
payload_tvb = tvb_new_subset(tvb, offset, captured_len, reported_len);
|
||||
}
|
||||
|
@ -1489,7 +1489,7 @@ dissect_ieee802154_assoc_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
|
|||
}
|
||||
|
||||
/* Call the data dissector for any leftover bytes. */
|
||||
if (tvb_length(tvb) > offset) {
|
||||
if (tvb_captured_length(tvb) > offset) {
|
||||
call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree);
|
||||
}
|
||||
} /* dissect_ieee802154_assoc_rsp */
|
||||
|
@ -1548,7 +1548,7 @@ dissect_ieee802154_disassoc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
}
|
||||
|
||||
/* Call the data dissector for any leftover bytes. */
|
||||
if (tvb_length(tvb) > 1) {
|
||||
if (tvb_captured_length(tvb) > 1) {
|
||||
call_dissector(data_handle, tvb_new_subset_remaining(tvb, 1), pinfo, tree);
|
||||
}
|
||||
} /* dissect_ieee802154_disassoc */
|
||||
|
@ -1628,7 +1628,7 @@ dissect_ieee802154_realign(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
}
|
||||
|
||||
/* Call the data dissector for any leftover bytes. */
|
||||
if (tvb_length(tvb) > offset) {
|
||||
if (tvb_captured_length(tvb) > offset) {
|
||||
call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree);
|
||||
}
|
||||
} /* dissect_ieee802154_realign */
|
||||
|
@ -1836,7 +1836,7 @@ dissect_ieee802154_decrypt(tvbuff_t *tvb, guint offset, packet_info *pinfo, ieee
|
|||
captured_len = reported_len;
|
||||
}
|
||||
else {
|
||||
captured_len = tvb_length_remaining(tvb, offset);
|
||||
captured_len = tvb_captured_length_remaining(tvb, offset);
|
||||
}
|
||||
|
||||
/* Check if the MIC is present in the captured data. */
|
||||
|
|
|
@ -155,7 +155,7 @@ ifcp_header_test(tvbuff_t *tvb, int offset)
|
|||
guint16 flen, flen1;
|
||||
|
||||
/* we can only do this test if we have 16 bytes or more */
|
||||
if(tvb_length_remaining(tvb, offset)<iFCP_MIN_HEADER_LEN){
|
||||
if(tvb_captured_length_remaining(tvb, offset)<iFCP_MIN_HEADER_LEN){
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ dissect_ifcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, voi
|
|||
fc_data_t fc_data;
|
||||
|
||||
/* verify we have a full header (do we need to do this? */
|
||||
if(tvb_length(tvb)<iFCP_ENCAP_HEADER_LEN){
|
||||
if(tvb_captured_length(tvb)<iFCP_ENCAP_HEADER_LEN){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index,
|
|||
}
|
||||
|
||||
hdrcksum = tvb_get_ntohs(tvb, 2);
|
||||
if (!pinfo->fragmented && tvb_length(tvb) >= len) {
|
||||
if (!pinfo->fragmented && tvb_captured_length(tvb) >= len) {
|
||||
/*
|
||||
* The packet isn't part of a fragmented datagram and isn't
|
||||
* truncated, so we can checksum it.
|
||||
|
@ -373,7 +373,7 @@ dissect_igmp_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
|
|||
offset += 1;
|
||||
|
||||
/* Just call the rest of it "data" */
|
||||
len = tvb_length_remaining(tvb, offset);
|
||||
len = tvb_captured_length_remaining(tvb, offset);
|
||||
proto_tree_add_item(tree, hf_data, tvb, offset, -1, ENC_NA);
|
||||
offset += len;
|
||||
|
||||
|
|
|
@ -696,7 +696,7 @@ dissect_imf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
item = proto_tree_add_item(tree, proto_imf, tvb, 0, -1, ENC_NA);
|
||||
tree = proto_item_add_subtree(item, ett_imf);
|
||||
|
||||
max_length = tvb_length(tvb);
|
||||
max_length = tvb_captured_length(tvb);
|
||||
/* first go through the tvb until we find a blank line and extract the content type if
|
||||
we find one */
|
||||
|
||||
|
|
Loading…
Reference in New Issue