forked from osmocom/wireshark
Convert some deprecated tvb_length calls
Change-Id: I6337f8e02a41106a363b9bf767bc4b3697442d41 Reviewed-on: https://code.wireshark.org/review/4027 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
64cabe9ed2
commit
c1bc1b6a83
|
@ -641,7 +641,7 @@ static gboolean
|
|||
test_njack(tvbuff_t *tvb)
|
||||
{
|
||||
/* We need at least 'NJ200' + 1 Byte packet type */
|
||||
if ( (tvb_length(tvb) < 6) ||
|
||||
if ( (tvb_captured_length(tvb) < 6) ||
|
||||
(tvb_strncaseeql(tvb, 0, "NJ200", 5) != 0) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -742,7 +742,7 @@ dissect_3gpp2_service_option_profile(proto_tree *tree, tvbuff_t *tvb, packet_i
|
|||
proto_tree_add_item(tree, hf_a11_serv_opt_prof_max_serv, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset+=4;
|
||||
|
||||
while (tvb_length_remaining(tvb,offset) > 0) {
|
||||
while (tvb_reported_length_remaining(tvb,offset) > 0) {
|
||||
sub_type_length = tvb_get_guint8(tvb,offset+1);
|
||||
|
||||
sub_type = tvb_get_guint8(tvb,offset);
|
||||
|
@ -786,7 +786,7 @@ dissect_3gpp2_radius_aut_flow_profile_ids(proto_tree *tree, tvbuff_t *tvb, pac
|
|||
guint8 sub_type, sub_type_length;
|
||||
guint32 value;
|
||||
|
||||
while (tvb_length_remaining(tvb,offset) > 0) {
|
||||
while (tvb_reported_length_remaining(tvb,offset) > 0) {
|
||||
sub_type = tvb_get_guint8(tvb,offset);
|
||||
sub_type_length = tvb_get_guint8(tvb,offset+1);
|
||||
/* value is 2 octets */
|
||||
|
|
|
@ -1829,10 +1829,10 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
|
|||
if (!iphc_tvb) return NULL;
|
||||
|
||||
/* Create the next header structure for the tunneled IPv6 header. */
|
||||
nhdr = (struct lowpan_nhdr *)wmem_alloc0(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + tvb_length(iphc_tvb));
|
||||
nhdr = (struct lowpan_nhdr *)wmem_alloc0(wmem_packet_scope(), sizeof(struct lowpan_nhdr) + tvb_captured_length(iphc_tvb));
|
||||
nhdr->next = NULL;
|
||||
nhdr->proto = IP_PROTO_IPV6;
|
||||
nhdr->length = tvb_length(iphc_tvb);
|
||||
nhdr->length = tvb_captured_length(iphc_tvb);
|
||||
nhdr->reported = tvb_reported_length(iphc_tvb);
|
||||
tvb_memcpy(iphc_tvb, LOWPAN_NHDR_DATA(nhdr), 0, nhdr->length);
|
||||
return nhdr;
|
||||
|
@ -1911,8 +1911,8 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
|
|||
call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, nhc_tree);
|
||||
|
||||
/* Copy the remainder, and truncate the real buffer length. */
|
||||
nhdr->length = tvb_length_remaining(tvb, offset) + (int)sizeof(struct ip6_ext);
|
||||
tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr) + sizeof(struct ip6_ext), offset, tvb_length_remaining(tvb, offset));
|
||||
nhdr->length = tvb_captured_length_remaining(tvb, offset) + (int)sizeof(struct ip6_ext);
|
||||
tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr) + sizeof(struct ip6_ext), offset, tvb_captured_length_remaining(tvb, offset));
|
||||
|
||||
/* There is nothing more we can do. */
|
||||
return nhdr;
|
||||
|
@ -2092,7 +2092,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
|
|||
|
||||
/* Copy the UDP header and payload into the buffer. */
|
||||
memcpy(LOWPAN_NHDR_DATA(nhdr), &udp, sizeof(struct udp_hdr));
|
||||
tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr) + sizeof(struct udp_hdr), offset, tvb_length_remaining(tvb, offset));
|
||||
tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr) + sizeof(struct udp_hdr), offset, tvb_captured_length_remaining(tvb, offset));
|
||||
return nhdr;
|
||||
}
|
||||
/*=====================================================
|
||||
|
@ -2324,7 +2324,7 @@ dissect_6lowpan_frag_first(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
}
|
||||
|
||||
/* Add this datagram to the fragment table. */
|
||||
frag_size = tvb_length(frag_tvb);
|
||||
frag_size = tvb_captured_length(frag_tvb);
|
||||
tvb_set_reported_length(frag_tvb, frag_size);
|
||||
save_fragmented = pinfo->fragmented;
|
||||
pinfo->fragmented = TRUE;
|
||||
|
|
|
@ -157,17 +157,17 @@ dissect_a_binary_command(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
|
|||
{
|
||||
default:
|
||||
{
|
||||
if(tvb_length(tvb) > 1)
|
||||
if(tvb_reported_length(tvb) > 1)
|
||||
proto_tree_add_item(subtree, hf_a_data, tvb, 1, -1, ENC_NA);
|
||||
break;
|
||||
}
|
||||
case CONTEXT_INFO:
|
||||
{
|
||||
for(i = 1; i<tvb_length(tvb); )
|
||||
for(i = 1; i<tvb_reported_length(tvb); )
|
||||
{
|
||||
switch(tvb_get_guint8(tvb, i))
|
||||
{
|
||||
default: i = tvb_length(tvb); continue;
|
||||
default: i = tvb_reported_length(tvb); continue;
|
||||
|
||||
case 1:
|
||||
case 3:
|
||||
|
@ -209,7 +209,7 @@ dissect_a_binary_command(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
|
|||
}
|
||||
case SET_TEXT:
|
||||
{
|
||||
if(tvb_length(tvb) > 3)
|
||||
if(tvb_reported_length(tvb) > 3)
|
||||
{
|
||||
proto_tree_add_item(subtree, hf_a_data, tvb, 1, 3, ENC_NA);
|
||||
proto_tree_add_item(subtree, hf_a_length, tvb, 4, 1, ENC_NA);
|
||||
|
@ -231,7 +231,7 @@ dissect_a_binary_command(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
|
|||
{
|
||||
proto_tree *infotree;
|
||||
|
||||
for(i=1; i<tvb_length(tvb); )
|
||||
for(i=1; i<tvb_reported_length(tvb); )
|
||||
{
|
||||
switch(tvb_get_guint8(tvb, i))
|
||||
{
|
||||
|
@ -347,7 +347,7 @@ dissect_a_binary_command(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree
|
|||
}
|
||||
case DO_COMMAND:
|
||||
{
|
||||
if(tvb_length(tvb) > 1)
|
||||
if(tvb_reported_length(tvb) > 1)
|
||||
{
|
||||
proto_tree_add_item(subtree, hf_a_line, tvb, 1, 1, ENC_NA);
|
||||
proto_tree_add_item(subtree, hf_a_length, tvb, 2, 1, ENC_NA);
|
||||
|
@ -387,7 +387,7 @@ dissect_aasp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
proto_item *ti; proto_tree *aasp_tree; guint n;
|
||||
|
||||
/* Check that there's enough data */
|
||||
n = tvb_length(tvb);
|
||||
n = tvb_reported_length(tvb);
|
||||
if(n < 3) return 0;
|
||||
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
|
|
@ -456,7 +456,7 @@ is_acn(tvbuff_t *tvb)
|
|||
{
|
||||
static const char acn_packet_id[] = "ASC-E1.17\0\0\0"; /* must be 12 bytes */
|
||||
|
||||
if (tvb_length(tvb) < (4+sizeof(acn_packet_id)))
|
||||
if (tvb_captured_length(tvb) < (4+sizeof(acn_packet_id)))
|
||||
return FALSE;
|
||||
|
||||
/* Check the bytes in octets 4 - 16 */
|
||||
|
@ -2756,7 +2756,7 @@ dissect_acn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
if (data_offset == old_offset) break;
|
||||
}
|
||||
}
|
||||
return tvb_length(tvb);
|
||||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -486,7 +486,7 @@ static int dissect_actrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
dissect_actrace_isdn(tvb, pinfo, tree, actrace_tree);
|
||||
break;
|
||||
}
|
||||
return tvb_length(tvb);
|
||||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue