Remove another batch of deprecated tvb_length calls
Change-Id: Icfdde38e40cca05d0705a081153a4ea3e8782ee7 Reviewed-on: https://code.wireshark.org/review/9086 Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
d0faa9adf8
commit
69cdfe9410
|
@ -883,7 +883,7 @@ dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
const char *desc;
|
||||
int len, is_moc, is_pdt, ies;
|
||||
|
||||
len = tvb_length(tvb);
|
||||
len = tvb_reported_length(tvb);
|
||||
|
||||
desc = "GMR-1 Channel Request (RACH)";
|
||||
ies = 0;
|
||||
|
|
|
@ -1801,7 +1801,7 @@ dissect_gmr1_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gint ti = -1;
|
||||
|
||||
/* Scan init */
|
||||
len = tvb_length(tvb);
|
||||
len = tvb_reported_length(tvb);
|
||||
offset = 0;
|
||||
|
||||
/* Safety */
|
||||
|
|
|
@ -96,7 +96,7 @@ static gboolean
|
|||
find_dir_tokens(tvbuff_t *tvb, gint name_start, gint *sel_start, gint *host_start, gint *port_start, gint *line_len, gint *next_offset) {
|
||||
gint remain;
|
||||
|
||||
if (tvb_length_remaining(tvb, name_start) < MIN_DIR_LINE_LEN)
|
||||
if (tvb_captured_length_remaining(tvb, name_start) < MIN_DIR_LINE_LEN)
|
||||
return FALSE;
|
||||
|
||||
if (! (sel_start && host_start && port_start && line_len && next_offset) )
|
||||
|
|
|
@ -406,7 +406,7 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
it_checksum = proto_tree_add_item(gre_tree, hf_gre_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
/* Checksum check !... */
|
||||
cksum = tvb_get_ntohs(tvb, offset);
|
||||
length = tvb_length(tvb);
|
||||
length = tvb_captured_length(tvb);
|
||||
reported_length = tvb_reported_length(tvb);
|
||||
/* The Checksum Present bit is set, and the packet isn't part of a
|
||||
fragmented datagram and isn't truncated, so we can checksum it. */
|
||||
|
|
|
@ -259,8 +259,8 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
fd_head=fragment_add(&gssapi_reassembly_table,
|
||||
tvb, 0, pinfo, fi->first_frame, NULL,
|
||||
gss_info->frag_offset,
|
||||
tvb_length(tvb), TRUE);
|
||||
gss_info->frag_offset+=tvb_length(tvb);
|
||||
tvb_captured_length(tvb), TRUE);
|
||||
gss_info->frag_offset+=tvb_captured_length(tvb);
|
||||
|
||||
/* we need more fragments */
|
||||
if(!fd_head){
|
||||
|
@ -307,14 +307,14 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
if (!(appclass == BER_CLASS_APP && pc && tag == 0)) {
|
||||
/* It could be NTLMSSP, with no OID. This can happen
|
||||
for anything that microsoft calls 'Negotiate' or GSS-SPNEGO */
|
||||
if ((tvb_length_remaining(gss_tvb, start_offset)>7) && (tvb_strneql(gss_tvb, start_offset, "NTLMSSP", 7) == 0)) {
|
||||
if ((tvb_captured_length_remaining(gss_tvb, start_offset)>7) && (tvb_strneql(gss_tvb, start_offset, "NTLMSSP", 7) == 0)) {
|
||||
return_offset = call_dissector(ntlmssp_handle,
|
||||
tvb_new_subset_remaining(gss_tvb, start_offset),
|
||||
pinfo, subtree);
|
||||
goto done;
|
||||
}
|
||||
/* Maybe it's new NTLMSSP payload */
|
||||
if ((tvb_length_remaining(gss_tvb, start_offset)>16) &&
|
||||
if ((tvb_captured_length_remaining(gss_tvb, start_offset)>16) &&
|
||||
((tvb_memeql(gss_tvb, start_offset, "\x01\x00\x00\x00", 4) == 0))) {
|
||||
return_offset = call_dissector(ntlmssp_payload_handle,
|
||||
tvb_new_subset_remaining(gss_tvb, start_offset),
|
||||
|
@ -322,7 +322,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
pinfo->gssapi_data_encrypted = TRUE;
|
||||
goto done;
|
||||
}
|
||||
if ((tvb_length_remaining(gss_tvb, start_offset)==16) &&
|
||||
if ((tvb_captured_length_remaining(gss_tvb, start_offset)==16) &&
|
||||
((tvb_memeql(gss_tvb, start_offset, "\x01\x00\x00\x00", 4) == 0))) {
|
||||
if( is_verifier ) {
|
||||
return_offset = call_dissector(ntlmssp_verf_handle,
|
||||
|
@ -339,7 +339,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
}
|
||||
|
||||
/* Maybe it's new GSSKRB5 CFX Wrapping */
|
||||
if ((tvb_length_remaining(gss_tvb, start_offset)>2) &&
|
||||
if ((tvb_captured_length_remaining(gss_tvb, start_offset)>2) &&
|
||||
((tvb_memeql(gss_tvb, start_offset, "\04\x04", 2) == 0) ||
|
||||
(tvb_memeql(gss_tvb, start_offset, "\05\x04", 2) == 0))) {
|
||||
return_offset = call_dissector(spnego_krb5_wrap_handle,
|
||||
|
@ -381,7 +381,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
proto_tree_add_expert_format(subtree, pinfo, &ei_gssapi_unknown_header, gss_tvb, start_offset, 0,
|
||||
"Unknown header (class=%d, pc=%d, tag=%d)",
|
||||
appclass, pc, tag);
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
goto done;
|
||||
} else {
|
||||
tvbuff_t *oid_tvb_local;
|
||||
|
@ -393,7 +393,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
handle = oidvalue->handle;
|
||||
len = call_dissector(handle, oid_tvb_local, pinfo, subtree);
|
||||
if (len == 0)
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
else
|
||||
return_offset = start_offset + len;
|
||||
goto done; /* We are finished here */
|
||||
|
@ -419,8 +419,8 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
*/
|
||||
if( (!pinfo->fd->flags.visited)
|
||||
&& (oidvalue)
|
||||
&& (tvb_length(gss_tvb)==tvb_reported_length(gss_tvb))
|
||||
&& (len1>(guint32)tvb_length_remaining(gss_tvb, oid_start_offset))
|
||||
&& (tvb_captured_length(gss_tvb)==tvb_reported_length(gss_tvb))
|
||||
&& (len1>(guint32)tvb_captured_length_remaining(gss_tvb, oid_start_offset))
|
||||
&& (gssapi_reassembly) ){
|
||||
fi=wmem_new(wmem_file_scope(), gssapi_frag_info_t);
|
||||
fi->first_frame=pinfo->fd->num;
|
||||
|
@ -429,13 +429,13 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
|
||||
fragment_add(&gssapi_reassembly_table,
|
||||
gss_tvb, 0, pinfo, pinfo->fd->num, NULL,
|
||||
0, tvb_length(gss_tvb), TRUE);
|
||||
0, tvb_captured_length(gss_tvb), TRUE);
|
||||
fragment_set_tot_len(&gssapi_reassembly_table,
|
||||
pinfo, pinfo->fd->num, NULL, len1+oid_start_offset);
|
||||
|
||||
gss_info->do_reassembly=TRUE;
|
||||
gss_info->first_frame=pinfo->fd->num;
|
||||
gss_info->frag_offset=tvb_length(gss_tvb);
|
||||
gss_info->frag_offset=tvb_captured_length(gss_tvb);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
/* No dissector for this oid */
|
||||
proto_tree_add_item(subtree, hf_gssapi_token_object, gss_tvb, oid_start_offset, -1, ENC_NA);
|
||||
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -472,12 +472,12 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
len = call_dissector(handle, oid_tvb, pinfo,
|
||||
subtree);
|
||||
if (len == 0)
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
else
|
||||
return_offset = offset + len;
|
||||
} else {
|
||||
proto_tree_add_item(subtree, hf_gssapi_auth_verifier, gss_tvb, offset, -1, ENC_NA);
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
}
|
||||
} else {
|
||||
handle = oidvalue->handle;
|
||||
|
@ -486,12 +486,12 @@ dissect_gssapi_work(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
len = call_dissector(handle, oid_tvb, pinfo,
|
||||
subtree);
|
||||
if (len == 0)
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
else
|
||||
return_offset = offset + len;
|
||||
} else {
|
||||
proto_tree_add_item(subtree, hf_gssapi_auth_credentials, gss_tvb, offset, -1, ENC_NA);
|
||||
return_offset = tvb_length(gss_tvb);
|
||||
return_offset = tvb_captured_length(gss_tvb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ wrap_dissect_gssapi(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
|
||||
dissect_gssapi(auth_tvb, pinfo, tree);
|
||||
|
||||
return tvb_length_remaining(tvb, offset);
|
||||
return tvb_captured_length_remaining(tvb, offset);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -293,7 +293,7 @@ static int dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo _U_, prot
|
|||
|
||||
hcast_tree = proto_item_add_subtree(ti, ett_hazelcast);
|
||||
}
|
||||
if (tvb_length_remaining(tvb, 0) < 13) {
|
||||
if (tvb_captured_length_remaining(tvb, 0) < 13) {
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "Hazelcast too short");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
val_to_str(dxsap, xsap_vals, "%04x"),
|
||||
val_to_str(sxsap, xsap_vals, "%04x"));
|
||||
|
||||
if (tvb_length_remaining(tvb, 7) > 0) {
|
||||
if (tvb_reported_length_remaining(tvb, 7) > 0) {
|
||||
next_tvb = tvb_new_subset_remaining(tvb, 7);
|
||||
if (!dissector_try_uint(subdissector_table,
|
||||
dxsap, next_tvb, pinfo, tree)) {
|
||||
|
|
|
@ -382,7 +382,7 @@ dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
ett_iapp_pdu, &pduitem, "Protocol data units");
|
||||
|
||||
dissect_pdus(tvb, pinfo, 2, pdutree, pduitem,
|
||||
tvb_length_remaining(tvb, 2));
|
||||
tvb_captured_length_remaining(tvb, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ is_icap_header:
|
|||
}
|
||||
}
|
||||
|
||||
datalen = tvb_length_remaining(tvb, offset);
|
||||
datalen = tvb_reported_length_remaining(tvb, offset);
|
||||
if (datalen > 0) {
|
||||
if(http_handle){
|
||||
new_tvb = tvb_new_subset_remaining(tvb, offset);
|
||||
|
|
|
@ -887,7 +887,7 @@ static void dissect_icep_reply(tvbuff_t *tvb, guint32 offset,
|
|||
DBG1("consumed --> %d\n", 5);
|
||||
|
||||
/* check if I got all reply data */
|
||||
tvb_data_remained = tvb_length_remaining(tvb, offset);
|
||||
tvb_data_remained = tvb_reported_length_remaining(tvb, offset);
|
||||
messageSize = tvb_get_letohl(tvb, 10);
|
||||
reported_reply_data = messageSize - (ICEP_HEADER_SIZE + ICEP_MIN_REPLY_SIZE);
|
||||
|
||||
|
@ -997,17 +997,17 @@ static int dissect_icep_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
switch(tvb_get_guint8(tvb, 8)) {
|
||||
case 0x0:
|
||||
DBG1("request message body: parsing %d bytes\n",
|
||||
tvb_length_remaining(tvb, offset));
|
||||
tvb_captured_length_remaining(tvb, offset));
|
||||
dissect_icep_request(tvb, offset, pinfo, icep_tree, ti);
|
||||
break;
|
||||
case 0x1:
|
||||
DBG1("batch request message body: parsing %d bytes\n",
|
||||
tvb_length_remaining(tvb, offset));
|
||||
tvb_captured_length_remaining(tvb, offset));
|
||||
dissect_icep_batch_request(tvb, offset, pinfo, icep_tree, ti);
|
||||
break;
|
||||
case 0x2:
|
||||
DBG1("reply message body: parsing %d bytes\n",
|
||||
tvb_length_remaining(tvb, offset));
|
||||
tvb_captured_length_remaining(tvb, offset));
|
||||
dissect_icep_reply(tvb, offset, pinfo, icep_tree, ti);
|
||||
break;
|
||||
case 0x3:
|
||||
|
|
|
@ -1689,7 +1689,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
|
|||
if (captured_length >= reported_length &&
|
||||
captured_length > fcs_len) {
|
||||
calc_fcs =
|
||||
crc32_802_tvb(next_tvb, tvb_length(next_tvb) - fcs_len);
|
||||
crc32_802_tvb(next_tvb, tvb_captured_length(next_tvb) - fcs_len);
|
||||
|
||||
/* By virtue of hdr_fcs_ti being set, we know that 'tree' is set,
|
||||
* so there's no need to check it here. */
|
||||
|
|
|
@ -68,7 +68,7 @@ dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
|
|||
}
|
||||
|
||||
/* Give the next dissector only 'length' number of bytes. */
|
||||
captured_length = tvb_length_remaining(tvb, offset_after_length);
|
||||
captured_length = tvb_captured_length_remaining(tvb, offset_after_length);
|
||||
if (captured_length > length)
|
||||
captured_length = length;
|
||||
next_tvb = tvb_new_subset(tvb, offset_after_length, captured_length, length);
|
||||
|
|
|
@ -170,7 +170,7 @@ dissect_ib_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
conversation_infiniband_data *convo_data = NULL;
|
||||
dissector_handle_t infiniband_handle;
|
||||
|
||||
if (tvb_length(tvb) < 16) /* check this has at least enough bytes for the BSDH */
|
||||
if (tvb_captured_length(tvb) < 16) /* check this has at least enough bytes for the BSDH */
|
||||
return 0;
|
||||
|
||||
if (gPREF_MAN_EN) {
|
||||
|
|
|
@ -60,21 +60,21 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPARS");
|
||||
|
||||
if (tvb_length_remaining(tvb, 0) >= 2 ) {
|
||||
if (tvb_captured_length_remaining(tvb, 0) >= 2 ) {
|
||||
ia = tvb_get_guint8(tvb, 0) & 0x3f;
|
||||
ta = tvb_get_guint8(tvb, 1) & 0x3f;
|
||||
if (ia == S1 && ta == S2) { /* if the first two bytes are S1/S2 skip over them */
|
||||
offset = 2;
|
||||
}
|
||||
}
|
||||
if (tvb_length_remaining(tvb, offset) >= 1) ia = tvb_get_guint8(tvb, offset + 0);
|
||||
if (tvb_length_remaining(tvb, offset) >= 2) ta = tvb_get_guint8(tvb, offset + 1);
|
||||
if (tvb_captured_length_remaining(tvb, offset) >= 1) ia = tvb_get_guint8(tvb, offset + 0);
|
||||
if (tvb_captured_length_remaining(tvb, offset) >= 2) ta = tvb_get_guint8(tvb, offset + 1);
|
||||
|
||||
if (ia == 0x83 || ia == 0x43 || ia == GA) { /* if it's an FPGA or 'corresponsdance code' 'go ahead'... */
|
||||
if (tvb_length_remaining(tvb, offset) > 2) { /* if the msg is long, it must have been a 'poll' */
|
||||
if (tvb_captured_length_remaining(tvb, offset) > 2) { /* if the msg is long, it must have been a 'poll' */
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Poll IA: %2.2X", ta);
|
||||
} else { /* if it's short, then it was a 'no traffic' response */
|
||||
if (tvb_length_remaining(tvb, offset) >= 2 ) {
|
||||
if (tvb_captured_length_remaining(tvb, offset) >= 2 ) {
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "GoAhead NextIA (0x%2.2X)", ta);
|
||||
} else {
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "GoAhead NextIA");
|
||||
|
@ -86,8 +86,8 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
if (ta == 0x20) {
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Reset IA: %2.2X", ia); /* the TA character was the 'reset' command */
|
||||
}
|
||||
if (tvb_length_remaining(tvb, offset) >= 3) cmd = tvb_get_guint8(tvb, offset + 2) & 0x3f; /* get the first two bytes of the data message */
|
||||
if (tvb_length_remaining(tvb, offset) >= 4) la = tvb_get_guint8(tvb, offset + 3) & 0x3f;
|
||||
if (tvb_captured_length_remaining(tvb, offset) >= 3) cmd = tvb_get_guint8(tvb, offset + 2) & 0x3f; /* get the first two bytes of the data message */
|
||||
if (tvb_captured_length_remaining(tvb, offset) >= 4) la = tvb_get_guint8(tvb, offset + 3) & 0x3f;
|
||||
if (cmd == 0x1f && la == 0x38) {
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Please Resend - IA: %2.2X TA: %2.2X", ia, ta); /* light the resend indicator */
|
||||
} else if (cmd == 0x2a && la == 0x05) {
|
||||
|
@ -98,7 +98,7 @@ dissect_ipars(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
}
|
||||
|
||||
if (tree) {
|
||||
bytes = tvb_length_remaining(tvb, 0);
|
||||
bytes = tvb_captured_length_remaining(tvb, 0);
|
||||
if (bytes > 0) {
|
||||
proto_tree *ipars_tree;
|
||||
proto_item *ti;
|
||||
|
|
|
@ -87,7 +87,7 @@ dissect_ipnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
|
||||
pktlen = tvb_get_ntohl(tvb, 4);
|
||||
next_tvb = tvb_new_subset_remaining(tvb, tvb_length(tvb) - pktlen);
|
||||
next_tvb = tvb_new_subset_remaining(tvb, tvb_captured_length(tvb) - pktlen);
|
||||
|
||||
family = tvb_get_guint8(tvb, 1);
|
||||
switch (family) {
|
||||
|
|
|
@ -167,11 +167,11 @@ static gboolean
|
|||
dissect_tcpencap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
guint32 reported_length = tvb_reported_length(tvb);
|
||||
guint32 length = tvb_length(tvb);
|
||||
guint32 captured_length = tvb_captured_length(tvb);
|
||||
|
||||
if (reported_length <= TRAILERLENGTH + 8 ||
|
||||
/* Ensure we have enough bytes for packet_is_tcpencap analysis */
|
||||
(reported_length - length) > (TRAILERLENGTH - 13) ||
|
||||
(reported_length - captured_length) > (TRAILERLENGTH - 13) ||
|
||||
!packet_is_tcpencap(tvb, pinfo, reported_length - TRAILERLENGTH) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
udpencap_tree = proto_item_add_subtree(ti, ett_udpencap);
|
||||
|
||||
/* 1 byte of 0xFF indicates NAT-keepalive */
|
||||
if ((tvb_length(tvb) == 1) && (tvb_get_guint8(tvb, 0) == 0xff)) {
|
||||
if ((tvb_captured_length(tvb) == 1) && (tvb_get_guint8(tvb, 0) == 0xff)) {
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "NAT-keepalive");
|
||||
proto_tree_add_item(udpencap_tree, hf_nat_keepalive, tvb, 0, 1, ENC_NA);
|
||||
} else {
|
||||
|
|
|
@ -1275,7 +1275,7 @@ dissect_esp_authentication(proto_tree *tree, tvbuff_t *tvb, gint len, gint esp_a
|
|||
else
|
||||
{
|
||||
/* Truncated so just display what we have */
|
||||
icv_tree = proto_tree_add_subtree(tree, tvb, len - esp_auth_len, esp_auth_len - (len - tvb_length(tvb)),
|
||||
icv_tree = proto_tree_add_subtree(tree, tvb, len - esp_auth_len, esp_auth_len - (len - tvb_captured_length(tvb)),
|
||||
ett_esp_icv, NULL, "Authentication Data (truncated)");
|
||||
bad = TRUE;
|
||||
}
|
||||
|
@ -1429,7 +1429,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
ip_dst = address_to_str(wmem_packet_scope(), &pinfo->dst);
|
||||
|
||||
/* Get the SPI */
|
||||
if (tvb_length(tvb) >= 4)
|
||||
if (tvb_captured_length(tvb) >= 4)
|
||||
{
|
||||
spi = tvb_get_ntohl(tvb, 0);
|
||||
}
|
||||
|
@ -2220,7 +2220,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
else
|
||||
{
|
||||
/* Truncated so just display what we have */
|
||||
proto_tree_add_bytes_format(esp_tree, hf_esp_authentication_data, tvb, len - 12, 12 - (len - tvb_length(tvb)),
|
||||
proto_tree_add_bytes_format(esp_tree, hf_esp_authentication_data, tvb, len - 12, 12 - (len - tvb_captured_length(tvb)),
|
||||
NULL, "Authentication Data (truncated)");
|
||||
}
|
||||
}
|
||||
|
@ -2287,7 +2287,7 @@ dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
* CPIs, we don't know the algorithm beforehand; if we get it
|
||||
* wrong, tvb_uncompress() returns NULL and nothing is displayed.
|
||||
*/
|
||||
decomp = tvb_child_uncompress(data, data, 0, tvb_length(data));
|
||||
decomp = tvb_child_uncompress(data, data, 0, tvb_captured_length(data));
|
||||
if (decomp) {
|
||||
add_new_data_source(pinfo, decomp, "IPcomp inflated data");
|
||||
saved_match_uint = pinfo->match_uint;
|
||||
|
|
|
@ -824,7 +824,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
tvb, 0, 0, spx_rexmit_info_p->num,
|
||||
"This is a retransmission of frame %u",
|
||||
spx_rexmit_info_p->num);
|
||||
if (tvb_length_remaining(tvb, hdr_len) > 0) {
|
||||
if (tvb_reported_length_remaining(tvb, hdr_len) > 0) {
|
||||
proto_tree_add_item(spx_tree, hf_spx_rexmt_data, tvb, hdr_len, -1, ENC_NA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -626,7 +626,7 @@ addTextKeys(packet_info *pinfo, proto_tree *tt, tvbuff_t *tvb, gint offset, guin
|
|||
|
||||
static gint
|
||||
handleHeaderDigest(iscsi_session_t *iscsi_session, proto_item *ti, tvbuff_t *tvb, guint offset, int headerLen) {
|
||||
int available_bytes = tvb_length_remaining(tvb, offset);
|
||||
int available_bytes = tvb_captured_length_remaining(tvb, offset);
|
||||
|
||||
switch(iscsi_session->header_digest){
|
||||
case ISCSI_DIGEST_CRC32:
|
||||
|
@ -648,7 +648,7 @@ handleHeaderDigest(iscsi_session_t *iscsi_session, proto_item *ti, tvbuff_t *tvb
|
|||
|
||||
static gint
|
||||
handleDataDigest(iscsi_session_t *iscsi_session, proto_item *ti, tvbuff_t *tvb, guint offset, int dataLen) {
|
||||
int available_bytes = tvb_length_remaining(tvb, offset);
|
||||
int available_bytes = tvb_captured_length_remaining(tvb, offset);
|
||||
|
||||
if (dataLen > 0) {
|
||||
switch (iscsi_session->data_digest){
|
||||
|
@ -723,7 +723,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
|
|||
gboolean S_bit=FALSE;
|
||||
gboolean A_bit=FALSE;
|
||||
guint cdb_offset = offset + 32; /* offset of CDB from start of PDU */
|
||||
guint end_offset = offset + tvb_length_remaining(tvb, offset);
|
||||
guint end_offset = offset + tvb_captured_length_remaining(tvb, offset);
|
||||
iscsi_conv_data_t *cdata = NULL;
|
||||
int paddedDataSegmentLength = data_segment_len;
|
||||
guint16 lun=0xffff;
|
||||
|
@ -1520,7 +1520,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
|
|||
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>snsl)
|
||||
tvb_len=snsl;
|
||||
tvb_rlen=tvb_reported_length_remaining(tvb, offset);
|
||||
|
@ -1640,7 +1640,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
|
|||
int tvb_len, tvb_rlen;
|
||||
|
||||
/* SCSI Command */
|
||||
tvb_len=tvb_length_remaining(tvb, cdb_offset);
|
||||
tvb_len=tvb_captured_length_remaining(tvb, cdb_offset);
|
||||
tvb_rlen=tvb_reported_length_remaining(tvb, cdb_offset);
|
||||
if(ahs_cdb_length && ahs_cdb_length<1024){
|
||||
guint8 *cdb_buf;
|
||||
|
@ -1675,7 +1675,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
|
|||
/* where there any ImmediateData ? */
|
||||
if(immediate_data_length){
|
||||
/* Immediate Data TVB */
|
||||
tvb_len=tvb_length_remaining(tvb, immediate_data_offset);
|
||||
tvb_len=tvb_captured_length_remaining(tvb, immediate_data_offset);
|
||||
if(tvb_len>(int)immediate_data_length)
|
||||
tvb_len=immediate_data_length;
|
||||
tvb_rlen=tvb_reported_length_remaining(tvb, immediate_data_offset);
|
||||
|
@ -1701,7 +1701,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
|
|||
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>senseLen)
|
||||
tvb_len=senseLen;
|
||||
tvb_rlen=tvb_reported_length_remaining(tvb, offset);
|
||||
|
@ -1724,7 +1724,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
|
|||
int tvb_len, tvb_rlen;
|
||||
|
||||
/* offset is setup correctly by the iscsi code for response above */
|
||||
tvb_len=tvb_length_remaining(tvb, offset);
|
||||
tvb_len=tvb_captured_length_remaining(tvb, offset);
|
||||
if(tvb_len>(int)data_segment_len)
|
||||
tvb_len=data_segment_len;
|
||||
tvb_rlen=tvb_reported_length_remaining(tvb, offset);
|
||||
|
@ -1746,7 +1746,7 @@ static int
|
|||
dissect_iscsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean check_port) {
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
guint offset = 0;
|
||||
guint32 available_bytes = tvb_length(tvb);
|
||||
guint32 available_bytes = tvb_captured_length(tvb);
|
||||
int digestsActive = 1;
|
||||
conversation_t *conversation = NULL;
|
||||
iscsi_session_t *iscsi_session=NULL;
|
||||
|
@ -2533,7 +2533,7 @@ dissect_iscsi_handle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
|
|||
*/
|
||||
static gboolean
|
||||
dissect_iscsi_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
|
||||
guint32 available_bytes = tvb_length(tvb);
|
||||
guint32 available_bytes = tvb_captured_length(tvb);
|
||||
|
||||
/* quick check to see if the packet is long enough to contain the
|
||||
* minimum amount of information we need */
|
||||
|
|
|
@ -797,7 +797,7 @@ dissect_hello_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
|
|||
break;
|
||||
case DATA_MISSING :
|
||||
proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_long_packet, tvb, offset, -1,
|
||||
"Packet length %d went beyond packet", tvb_length(tvb) );
|
||||
"Packet length %d went beyond packet", tvb_captured_length(tvb) );
|
||||
break;
|
||||
case CKSUM_NOT_OK :
|
||||
proto_tree_add_uint_format_value( tree, hf_isis_hello_checksum, tvb, offset, length, checksum,
|
||||
|
|
|
@ -148,7 +148,7 @@ dissect_snp_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
|
|||
break;
|
||||
case DATA_MISSING :
|
||||
expert_add_info_format(pinfo, ti, &ei_isis_csnp_long_packet,
|
||||
"Packet length %d went beyond packet", tvb_length(tvb));
|
||||
"Packet length %d went beyond packet", tvb_captured_length(tvb));
|
||||
break;
|
||||
case CKSUM_NOT_OK :
|
||||
proto_item_append_text(ti, " [incorrect, should be 0x%04x]", cacl_checksum);
|
||||
|
|
|
@ -259,7 +259,7 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len)
|
|||
length -= 12;
|
||||
|
||||
/* Trim the captured length. */
|
||||
captured_length = tvb_length_remaining(payload_tvb, 12);
|
||||
captured_length = tvb_captured_length_remaining(payload_tvb, 12);
|
||||
|
||||
/* Make sure it's not bigger than the actual length. */
|
||||
if (captured_length > length)
|
||||
|
|
|
@ -693,7 +693,7 @@ get_isns_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _
|
|||
static int
|
||||
dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
gint length = tvb_length(tvb);
|
||||
gint length = tvb_captured_length(tvb);
|
||||
guint16 isns_protocol_version;
|
||||
guint16 function_id;
|
||||
|
||||
|
@ -724,7 +724,7 @@ dissect_isns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
|
|||
static int
|
||||
dissect_isns_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
gint length = tvb_length(tvb);
|
||||
gint length = tvb_captured_length(tvb);
|
||||
guint16 isns_protocol_version;
|
||||
guint16 function_id;
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ dissect_itdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
/* ZZZ for now, 125 usec mode and I-TDM control protocol
|
||||
* need to add 1ms mode */
|
||||
if (tvb_length(tvb) < 18)
|
||||
if (tvb_captured_length(tvb) < 18)
|
||||
return;
|
||||
|
||||
/* See if this packet is a data flow or the I-TDM control flow. */
|
||||
|
|
|
@ -84,7 +84,7 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi
|
|||
guint8 source;
|
||||
|
||||
/* Need at least 15 bytes. */
|
||||
tvblen = tvb_length(tvb);
|
||||
tvblen = tvb_captured_length(tvb);
|
||||
if (tvblen < 15) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ val_repr_len(fvalue_t *fv, ftrepr_t rtype, int field_display _U_)
|
|||
TRY {
|
||||
/* 3 bytes for each byte of the byte "NN:" minus 1 byte
|
||||
* as there's no trailing ":". */
|
||||
length = tvb_length(fv->value.tvb) * 3 - 1;
|
||||
length = tvb_captured_length(fv->value.tvb) * 3 - 1;
|
||||
}
|
||||
CATCH_ALL {
|
||||
/* nothing */
|
||||
|
@ -145,7 +145,7 @@ val_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display _U_, char * volatile
|
|||
g_assert(rtype == FTREPR_DFILTER);
|
||||
|
||||
TRY {
|
||||
length = tvb_length(fv->value.tvb);
|
||||
length = tvb_captured_length(fv->value.tvb);
|
||||
|
||||
if (length)
|
||||
buf = bytes_to_hexstr_punct(buf, tvb_get_ptr(fv->value.tvb, 0, length), length, ':');
|
||||
|
@ -170,7 +170,7 @@ len(fvalue_t *fv)
|
|||
|
||||
TRY {
|
||||
if (fv->value.tvb)
|
||||
length = tvb_length(fv->value.tvb);
|
||||
length = tvb_captured_length(fv->value.tvb);
|
||||
}
|
||||
CATCH_ALL {
|
||||
/* nothing */
|
||||
|
@ -206,9 +206,9 @@ cmp_eq(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
volatile gboolean eq = FALSE;
|
||||
|
||||
TRY {
|
||||
guint a_len = tvb_length(a);
|
||||
guint a_len = tvb_captured_length(a);
|
||||
|
||||
if (a_len == tvb_length(b))
|
||||
if (a_len == tvb_captured_length(b))
|
||||
eq = (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) == 0);
|
||||
}
|
||||
CATCH_ALL {
|
||||
|
@ -227,9 +227,9 @@ cmp_ne(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
volatile gboolean ne = TRUE;
|
||||
|
||||
TRY {
|
||||
guint a_len = tvb_length(a);
|
||||
guint a_len = tvb_captured_length(a);
|
||||
|
||||
if (a_len == tvb_length(b)) {
|
||||
if (a_len == tvb_captured_length(b)) {
|
||||
ne = (memcmp(tvb_get_ptr(a, 0, a_len), tvb_get_ptr(b, 0, a_len), a_len) != 0);
|
||||
}
|
||||
}
|
||||
|
@ -249,8 +249,8 @@ cmp_gt(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
volatile gboolean gt = FALSE;
|
||||
|
||||
TRY {
|
||||
guint a_len = tvb_length(a);
|
||||
guint b_len = tvb_length(b);
|
||||
guint a_len = tvb_captured_length(a);
|
||||
guint b_len = tvb_captured_length(b);
|
||||
|
||||
if (a_len > b_len) {
|
||||
gt = TRUE;
|
||||
|
@ -274,8 +274,8 @@ cmp_ge(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
volatile gboolean ge = FALSE;
|
||||
|
||||
TRY {
|
||||
guint a_len = tvb_length(a);
|
||||
guint b_len = tvb_length(b);
|
||||
guint a_len = tvb_captured_length(a);
|
||||
guint b_len = tvb_captured_length(b);
|
||||
|
||||
if (a_len > b_len) {
|
||||
ge = TRUE;
|
||||
|
@ -299,8 +299,8 @@ cmp_lt(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
volatile gboolean lt = FALSE;
|
||||
|
||||
TRY {
|
||||
guint a_len = tvb_length(a);
|
||||
guint b_len = tvb_length(b);
|
||||
guint a_len = tvb_captured_length(a);
|
||||
guint b_len = tvb_captured_length(b);
|
||||
|
||||
if (a_len < b_len) {
|
||||
lt = TRUE;
|
||||
|
@ -324,8 +324,8 @@ cmp_le(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
volatile gboolean le = FALSE;
|
||||
|
||||
TRY {
|
||||
guint a_len = tvb_length(a);
|
||||
guint b_len = tvb_length(b);
|
||||
guint a_len = tvb_captured_length(a);
|
||||
guint b_len = tvb_captured_length(b);
|
||||
|
||||
if (a_len < b_len) {
|
||||
le = TRUE;
|
||||
|
@ -379,7 +379,7 @@ cmp_matches(const fvalue_t *fv_a, const fvalue_t *fv_b)
|
|||
return FALSE;
|
||||
}
|
||||
TRY {
|
||||
tvb_len = tvb_length(tvb);
|
||||
tvb_len = tvb_captured_length(tvb);
|
||||
data = (const char *)tvb_get_ptr(tvb, 0, tvb_len);
|
||||
rc = g_regex_match_full(
|
||||
regex, /* Compiled PCRE */
|
||||
|
|
|
@ -93,7 +93,7 @@ void ByteViewTab::protoTreeItemChanged(QTreeWidgetItem *current) {
|
|||
int f_start = -1, f_end = -1, f_len = -1;
|
||||
int fa_start = -1, fa_end = -1, fa_len = -1;
|
||||
int p_start = -1, p_end = -1, p_len = -1;
|
||||
guint len = tvb_length(fi->ds_tvb);
|
||||
guint len = tvb_captured_length(fi->ds_tvb);
|
||||
|
||||
// Find and highlight the protocol bytes
|
||||
while (parent && parent->parent()) {
|
||||
|
|
|
@ -378,10 +378,10 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo,
|
|||
|
||||
follow_record = g_new(follow_record_t,1);
|
||||
|
||||
follow_record->data = g_byte_array_sized_new(tvb_length(next_tvb));
|
||||
follow_record->data = g_byte_array_sized_new(tvb_captured_length(next_tvb));
|
||||
follow_record->data = g_byte_array_append(follow_record->data,
|
||||
tvb_get_ptr(next_tvb, 0, -1),
|
||||
tvb_length(next_tvb));
|
||||
tvb_captured_length(next_tvb));
|
||||
follow_record->packet_num = pinfo->fd->num;
|
||||
|
||||
if (follow_info->client_port == 0) {
|
||||
|
|
Loading…
Reference in New Issue