forked from osmocom/wireshark
Remove more tvb_length
Change-Id: I940704e927001b2a051a59fd0738e7a02328472b Reviewed-on: https://code.wireshark.org/review/9031 Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
df352c535f
commit
11803d422f
|
@ -324,7 +324,7 @@ dissect_png_text(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|||
{
|
||||
gint offset=0, nul_offset;
|
||||
|
||||
nul_offset = tvb_find_guint8(tvb, offset, tvb_length_remaining(tvb, offset), 0);
|
||||
nul_offset = tvb_find_guint8(tvb, offset, tvb_captured_length_remaining(tvb, offset), 0);
|
||||
/* nul_offset == 0 means empty keyword, this is not allowed by the png standard */
|
||||
if (nul_offset<=0) {
|
||||
/* XXX exception */
|
||||
|
@ -334,7 +334,7 @@ dissect_png_text(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|||
proto_tree_add_item(tree, &hfi_png_text_keyword, tvb, offset, nul_offset, ENC_ISO_8859_1|ENC_NA);
|
||||
offset = nul_offset+1; /* length of the key word + 0 character */
|
||||
|
||||
proto_tree_add_item(tree, &hfi_png_text_string, tvb, offset, tvb_length_remaining(tvb, offset), ENC_ISO_8859_1|ENC_NA);
|
||||
proto_tree_add_item(tree, &hfi_png_text_string, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_ISO_8859_1|ENC_NA);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -501,37 +501,37 @@ dissect_acr122(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
sub_item = proto_tree_add_uint(main_tree, hf_response, tvb, offset, tvb_length_remaining(tvb, offset), command);
|
||||
sub_item = proto_tree_add_uint(main_tree, hf_response, tvb, offset, tvb_captured_length_remaining(tvb, offset), command);
|
||||
PROTO_ITEM_SET_GENERATED(sub_item);
|
||||
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Response: %s", val_to_str_ext_const(command, &command_vals_ext, "Unknown"));
|
||||
|
||||
if (command != CMD_UNKNOWN) {
|
||||
sub_item = proto_tree_add_uint(main_tree, hf_response_for, tvb, offset, tvb_length_remaining(tvb, offset), command_frame_number);
|
||||
sub_item = proto_tree_add_uint(main_tree, hf_response_for, tvb, offset, tvb_captured_length_remaining(tvb, offset), command_frame_number);
|
||||
PROTO_ITEM_SET_GENERATED(sub_item);
|
||||
}
|
||||
|
||||
switch (command) {
|
||||
case CMD_GET_FIRMWARE_VERSION:
|
||||
proto_tree_add_item(main_tree, hf_firmware_version, tvb, offset, -1, ENC_NA | ENC_ASCII);
|
||||
offset += tvb_length_remaining(tvb, offset);
|
||||
offset += tvb_captured_length_remaining(tvb, offset);
|
||||
break;
|
||||
|
||||
case CMD_DIRECT_TRANSMIT:
|
||||
use_status_word = TRUE;
|
||||
|
||||
if (tvb_length_remaining(tvb, offset) > 2) {
|
||||
next_tvb = tvb_new_subset_length(tvb, offset, tvb_length_remaining(tvb, offset) - 2);
|
||||
if (tvb_captured_length_remaining(tvb, offset) > 2) {
|
||||
next_tvb = tvb_new_subset_length(tvb, offset, tvb_captured_length_remaining(tvb, offset) - 2);
|
||||
call_dissector_with_data(pn532_handle, next_tvb, pinfo, tree, usb_conv_info);
|
||||
offset += tvb_length_remaining(tvb, offset) - 2;
|
||||
offset += tvb_captured_length_remaining(tvb, offset) - 2;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case CMD_READ_BINARY_BLOCKS:
|
||||
use_status_word = TRUE;
|
||||
proto_tree_add_item(main_tree, hf_data, tvb, offset, tvb_length_remaining(tvb, offset) - 2, ENC_NA);
|
||||
offset += tvb_length_remaining(tvb, offset) - 2;
|
||||
proto_tree_add_item(main_tree, hf_data, tvb, offset, tvb_captured_length_remaining(tvb, offset) - 2, ENC_NA);
|
||||
offset += tvb_captured_length_remaining(tvb, offset) - 2;
|
||||
break;
|
||||
|
||||
case CMD_READ_VALUE_BLOCK:
|
||||
|
@ -541,14 +541,14 @@ dissect_acr122(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
|||
|
||||
case CMD_GET_DATA_UID:
|
||||
use_status_word = TRUE;
|
||||
proto_tree_add_item(main_tree, hf_uid, tvb, offset, tvb_length_remaining(tvb, offset) - 2, ENC_NA);
|
||||
offset += tvb_length_remaining(tvb, offset) - 2;
|
||||
proto_tree_add_item(main_tree, hf_uid, tvb, offset, tvb_captured_length_remaining(tvb, offset) - 2, ENC_NA);
|
||||
offset += tvb_captured_length_remaining(tvb, offset) - 2;
|
||||
break;
|
||||
|
||||
case CMD_GET_DATA_ATS:
|
||||
use_status_word = TRUE;
|
||||
proto_tree_add_item(main_tree, hf_ats, tvb, offset, tvb_length_remaining(tvb, offset) - 2, ENC_NA);
|
||||
offset += tvb_length_remaining(tvb, offset) - 2;
|
||||
proto_tree_add_item(main_tree, hf_ats, tvb, offset, tvb_captured_length_remaining(tvb, offset) - 2, ENC_NA);
|
||||
offset += tvb_captured_length_remaining(tvb, offset) - 2;
|
||||
break;
|
||||
|
||||
case CMD_BI_COLOR_AND_BUZZER_LED_CONTROL:
|
||||
|
|
|
@ -477,7 +477,7 @@ gboolean dissect_bt_dht_heur (tvbuff_t *tvb, packet_info *pinfo,
|
|||
/* try dissecting */
|
||||
/* Assume dictionary (d) is followed by a one char long (1:) key string. */
|
||||
|
||||
if(tvb_length(tvb) < 4)
|
||||
if(tvb_captured_length(tvb) < 4)
|
||||
return FALSE;
|
||||
|
||||
if(tvb_memeql(tvb, 0, "d1:", 3) != 0)
|
||||
|
|
|
@ -161,7 +161,7 @@ get_utp_version(tvbuff_t *tvb) {
|
|||
|
||||
/* Simple heuristics inspired by code from utp.cpp */
|
||||
|
||||
len = tvb_length(tvb);
|
||||
len = tvb_captured_length(tvb);
|
||||
|
||||
/* Version 1? */
|
||||
if (len < V1_FIXED_HDR_SIZE) {
|
||||
|
@ -357,7 +357,7 @@ dissect_bt_utp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
|
||||
offset = dissect_utp_extension(tvb, pinfo, sub_tree, offset, &extension_type);
|
||||
|
||||
len_tvb = tvb_length_remaining(tvb, offset);
|
||||
len_tvb = tvb_captured_length_remaining(tvb, offset);
|
||||
if(len_tvb > 0)
|
||||
proto_tree_add_item(sub_tree, hf_bt_utp_data, tvb, offset, len_tvb, ENC_NA);
|
||||
|
||||
|
|
|
@ -230,8 +230,8 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
|
|||
Global Items are declared in the report descriptor, and in
|
||||
Boot Protocol Mode. Otherwise the field does not exist."
|
||||
*/
|
||||
if (((parameter >> 3) && tvb_length_remaining(tvb, offset) >= 3) ||
|
||||
(!(parameter >> 3) && tvb_length_remaining(tvb, offset) >= 1)) {
|
||||
if (((parameter >> 3) && tvb_reported_length_remaining(tvb, offset) >= 3) ||
|
||||
(!(parameter >> 3) && tvb_reported_length_remaining(tvb, offset) >= 1)) {
|
||||
proto_tree_add_item(bthid_tree, hf_bthid_report_id, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
|
|||
|
||||
/* playload */
|
||||
proto_tree_add_item(bthid_tree, hf_bthid_data, tvb, offset, -1, ENC_NA);
|
||||
offset += tvb_length_remaining(tvb, offset);
|
||||
offset += tvb_captured_length_remaining(tvb, offset);
|
||||
break;
|
||||
case 0x06: /* GET_PROTOCOL */
|
||||
proto_tree_add_item(bthid_tree, hf_bthid_parameter_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -82,7 +82,7 @@ dissect_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gboolean is_802_2 = TRUE;
|
||||
|
||||
/* Don't throw an exception for this check (even a BoundsError) */
|
||||
if (tvb_length_remaining(tvb, 4) >= 2) {
|
||||
if (tvb_captured_length_remaining(tvb, 4) >= 2) {
|
||||
if (tvb_get_ntohs(tvb, 4) == 0xffff)
|
||||
is_802_2 = FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue