diff options
-rw-r--r-- | epan/dissectors/packet-dcerpc.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee8021ah.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-megaco.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-mikey.c | 80 | ||||
-rw-r--r-- | epan/dissectors/packet-mmse.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-ndps.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-nfs.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-rx.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-smb.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl.c | 32 | ||||
-rw-r--r-- | epan/dissectors/packet-wsp.c | 124 |
12 files changed, 20 insertions, 312 deletions
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 6bf658b058..941725cb49 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -1183,7 +1183,6 @@ static void dissect_auth_verf(tvbuff_t *auth_tvb, packet_info *pinfo, if (fn) fn(auth_tvb, 0, pinfo, tree, &di, hdr->drep); else { - tvb_ensure_bytes_exist(auth_tvb, 0, hdr->auth_len); proto_tree_add_text(tree, auth_tvb, 0, hdr->auth_len, "%s Verifier", val_to_str(auth_info->auth_type, @@ -1923,8 +1922,7 @@ dissect_ndr_byte_array(tvbuff_t *tvb, int offset, packet_info *pinfo, hf_dcerpc_array_actual_count, &len); DISSECTOR_ASSERT(len <= G_MAXUINT32); - if (tree && len) { - tvb_ensure_bytes_exist(tvb, offset, (guint32)len); + if (len) { proto_tree_add_item(tree, di->hf_index, tvb, offset, (guint32)len, ENC_NA); } @@ -2515,7 +2513,6 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* get the referent id */ offset = dissect_ndr_uint3264(tvb, offset, pinfo, NULL, di, drep, -1, &id); - tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, @@ -2560,7 +2557,6 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* get the referent id */ offset = dissect_ndr_uint3264(tvb, offset, pinfo, NULL, di, drep, -1, &id); - tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, @@ -2594,7 +2590,6 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* get the referent id */ offset = dissect_ndr_uint3264(tvb, offset, pinfo, NULL, di, drep, -1, &id); - tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* new pointer */ tr = proto_tree_add_subtree(tree, tvb, offset-pointer_size, pointer_size, @@ -2620,7 +2615,6 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* get the referent id */ offset = dissect_ndr_uint3264(tvb, offset, pinfo, NULL, di, drep, -1, &id); - tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, @@ -2655,7 +2649,6 @@ dissect_ndr_pointer_cb(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* get the referent id */ offset = dissect_ndr_uint3264(tvb, offset, pinfo, NULL, di, drep, -1, &id); - tvb_ensure_bytes_exist(tvb, offset-pointer_size, pointer_size); /* we got a NULL pointer */ if (id == 0) { proto_tree_add_text(tree, tvb, offset-pointer_size, @@ -2775,27 +2768,23 @@ show_stub_data(tvbuff_t *tvb, gint offset, proto_tree *dcerpc_tree, if ((auth_info != NULL) && (auth_info->auth_level == DCE_C_AUTHN_LEVEL_PKT_PRIVACY)) { if (is_encrypted) { - tvb_ensure_bytes_exist(tvb, offset, length); proto_tree_add_text(dcerpc_tree, tvb, offset, length, "Encrypted stub data (%d byte%s)", length, plurality(length, "", "s")); /* is the padding is still inside the encrypted blob, don't display it explicit */ auth_pad_len = 0; } else { - tvb_ensure_bytes_exist(tvb, offset, plain_length); proto_tree_add_text(dcerpc_tree, tvb, offset, plain_length, "Decrypted stub data (%d byte%s)", plain_length, plurality(plain_length, "", "s")); } } else { - tvb_ensure_bytes_exist(tvb, offset, plain_length); proto_tree_add_text(dcerpc_tree, tvb, offset, plain_length, "Stub data (%d byte%s)", plain_length, plurality(plain_length, "", "s")); } /* If there is auth padding at the end of the stub, display it */ if (auth_pad_len != 0) { - tvb_ensure_bytes_exist(tvb, auth_pad_offset, auth_pad_len); proto_tree_add_text(dcerpc_tree, tvb, auth_pad_offset, auth_pad_len, "Auth Padding (%u byte%s)", @@ -3025,7 +3014,6 @@ dcerpc_try_handoff(packet_info *pinfo, proto_tree *tree, /* If there is auth padding at the end of the stub, display it */ if (auth_pad_len != 0) { - tvb_ensure_bytes_exist(tvb, auth_pad_offset, auth_pad_len); proto_tree_add_text(sub_tree, decrypted_tvb, auth_pad_offset, auth_pad_len, "Auth Padding (%u byte%s)", @@ -3083,7 +3071,6 @@ dissect_dcerpc_verifier(tvbuff_t *tvb, packet_info *pinfo, show_exception(auth_tvb, pinfo, dcerpc_tree, EXCEPT_CODE, GET_MESSAGE); } ENDTRY; } else { - tvb_ensure_bytes_exist(tvb, 0, hdr->auth_len); proto_tree_add_text(dcerpc_tree, auth_tvb, 0, hdr->auth_len, "Auth Verifier"); } @@ -3444,7 +3431,6 @@ dissect_dcerpc_cn_bind_ack(tvbuff_t *tvb, gint offset, packet_info *pinfo, offset = dissect_dcerpc_uint16(tvb, offset, pinfo, dcerpc_tree, hdr->drep, hf_dcerpc_cn_sec_addr_len, &sec_addr_len); if (sec_addr_len != 0) { - tvb_ensure_bytes_exist(tvb, offset, sec_addr_len); proto_tree_add_item(dcerpc_tree, hf_dcerpc_cn_sec_addr, tvb, offset, sec_addr_len, ENC_ASCII|ENC_NA); offset += sec_addr_len; @@ -4267,7 +4253,6 @@ dissect_dcerpc_cn_fault(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ if (dcerpc_tree) { if (stub_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, stub_length); proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, "Fault stub data (%d byte%s)", stub_length, @@ -4278,7 +4263,6 @@ dissect_dcerpc_cn_fault(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* PDU is fragmented and this isn't the first fragment */ if (dcerpc_tree) { if (stub_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, stub_length); proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, "Fragment data (%d byte%s)", stub_length, @@ -4293,7 +4277,6 @@ dissect_dcerpc_cn_fault(tvbuff_t *tvb, gint offset, packet_info *pinfo, third means we can attempt reassembly. */ if (dcerpc_tree) { if (length > 0) { - tvb_ensure_bytes_exist(tvb, offset, stub_length); proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, "Fragment data (%d byte%s)", stub_length, @@ -4340,7 +4323,6 @@ dissect_dcerpc_cn_fault(tvbuff_t *tvb, gint offset, packet_info *pinfo, */ if (dcerpc_tree) { if (length > 0) { - tvb_ensure_bytes_exist(tvb, offset, stub_length); proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, "Fault stub data (%d byte%s)", stub_length, @@ -5315,7 +5297,6 @@ dissect_dcerpc_dg_stub(tvbuff_t *tvb, int offset, packet_info *pinfo, /* PDU is fragmented and this isn't the first fragment */ if (dcerpc_tree) { if (length > 0) { - tvb_ensure_bytes_exist(tvb, offset, stub_length); proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, "Fragment data (%d byte%s)", stub_length, @@ -5330,7 +5311,6 @@ dissect_dcerpc_dg_stub(tvbuff_t *tvb, int offset, packet_info *pinfo, third means we can attempt reassembly. */ if (dcerpc_tree) { if (length > 0) { - tvb_ensure_bytes_exist(tvb, offset, stub_length); proto_tree_add_text(dcerpc_tree, tvb, offset, stub_length, "Fragment data (%d byte%s)", stub_length, plurality(stub_length, "", "s")); diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c index 69830aff28..1c96513e9c 100644 --- a/epan/dissectors/packet-ieee8021ah.c +++ b/epan/dissectors/packet-ieee8021ah.c @@ -265,25 +265,19 @@ dissect_ieee8021ah_common(tvbuff_t *tvb, packet_info *pinfo, proto_item_set_text(ieee8021ah_tag_tree, "I-Tag, I-SID: %d", tci & IEEE8021AH_ISIDMASK); - /* ensure size of tag */ - tvb_ensure_bytes_exist(tvb, 4, 12); + proto_tree_add_item(tree, hf_ieee8021ah_c_daddr, tvb, 4, 6, ENC_NA); + proto_tree_add_item(tree, hf_ieee8021ah_c_saddr, tvb, 10, 6, ENC_NA); /* parse out IP addrs */ dst_addr = tvb_get_ptr(tvb, 4, 6); /* safe to use this function? */ src_addr = tvb_get_ptr(tvb, 10, 6); - proto_tree_add_ether(tree, hf_ieee8021ah_c_daddr, - tvb, 4, 6, dst_addr); - - proto_tree_add_ether(tree, hf_ieee8021ah_c_saddr, - tvb, 10, 6, src_addr); - /* add text to 802.1ad label */ if (parent) { proto_item_append_text(tree, ", I-SID: %d, C-Src: %s (%s), C-Dst: %s (%s)", tci & IEEE8021AH_ISIDMASK, get_ether_name(src_addr), - ether_to_str(src_addr), get_ether_name(dst_addr), - ether_to_str(dst_addr)); + tvb_ether_to_str(tvb, 10), get_ether_name(dst_addr), + tvb_ether_to_str(tvb, 4)); } } diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 7a6632ea68..1097a0d240 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -1142,7 +1142,6 @@ nextcontext: proto_item *item; tokenlen = (tvb_RBRKT+1) - tvb_previous_offset; - tvb_ensure_bytes_exist(tvb, tvb_previous_offset, tokenlen); item = proto_tree_add_string(megaco_tree, hf_megaco_error_Frame, tvb, tvb_previous_offset, tokenlen, "No Command detectable !"); diff --git a/epan/dissectors/packet-mikey.c b/epan/dissectors/packet-mikey.c index 4a8f524b59..06beba3401 100644 --- a/epan/dissectors/packet-mikey.c +++ b/epan/dissectors/packet-mikey.c @@ -646,8 +646,6 @@ add_next_payload(tvbuff_t *tvb, proto_tree *tree, int offset) static int dissect_payload_cs_id_srtp(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - tvb_ensure_bytes_exist(tvb, 0, 9); - if (tree) { proto_item *id_ti; proto_tree *id_tree; @@ -750,7 +748,6 @@ dissect_payload_kemac(mikey_t *mikey, tvbuff_t *tvb, packet_info *pinfo, proto_t guint16 mac_length; guint8 mac_alg; - tvb_ensure_bytes_exist(tvb, offset+0, 4); encr_alg = tvb_get_guint8(tvb, offset+1); encr_length = tvb_get_ntohs(tvb, offset+2); tvb_ensure_bytes_exist(tvb, offset+4, encr_length+1); @@ -788,10 +785,7 @@ dissect_payload_kemac(mikey_t *mikey, tvbuff_t *tvb, packet_info *pinfo, proto_t return 0; } - tvb_ensure_bytes_exist(tvb, offset+4+encr_length+1, mac_length); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_KEMAC_MAC], tvb, 4+encr_length+1, mac_length, ENC_NA); - } + proto_tree_add_item(tree, hf_mikey[POS_KEMAC_MAC], tvb, 4+encr_length+1, mac_length, ENC_NA); return 4+encr_length+1+mac_length; } @@ -802,7 +796,6 @@ dissect_payload_pke(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, p int offset = 0; guint16 length; - tvb_ensure_bytes_exist(tvb, offset+0, 3); length = tvb_get_ntohs(tvb, offset+1) &0x3ff; if (tree) { @@ -811,10 +804,7 @@ dissect_payload_pke(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, p proto_tree_add_item(tree, hf_mikey[POS_PKE_DATA_LEN], tvb, 1, 2, ENC_BIG_ENDIAN); } - tvb_ensure_bytes_exist(tvb, offset+3, length); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_PKE_DATA], tvb, 3, length, ENC_NA); - } + proto_tree_add_item(tree, hf_mikey[POS_PKE_DATA], tvb, 3, length, ENC_NA); return 3 + length; } @@ -826,7 +816,6 @@ dissect_payload_dh(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pr int dh_length; guint8 kv; - tvb_ensure_bytes_exist(tvb, offset+0, 2); dh_group = tvb_get_guint8(tvb, offset+1); switch (dh_group) { @@ -843,7 +832,6 @@ dissect_payload_dh(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pr return 0; } - tvb_ensure_bytes_exist(tvb, offset+2, dh_length+1); kv = tvb_get_guint8(tvb, offset+2+dh_length) & 0x0f; if (tree) { @@ -866,7 +854,6 @@ dissect_payload_sign(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, int offset = 0; guint16 length; - tvb_ensure_bytes_exist(tvb, offset+0, 2); length = ((tvb_get_guint8(tvb, offset+0) & 0x0f) << 8) + tvb_get_guint8(tvb, offset+1); if (tree) { @@ -874,10 +861,7 @@ dissect_payload_sign(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree_add_uint(tree, hf_mikey[POS_SIGNATURE_LEN], tvb, 0, 2, length); } - tvb_ensure_bytes_exist(tvb, offset+2, length); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_SIGNATURE], tvb, 2, length, ENC_NA); - } + proto_tree_add_item(tree, hf_mikey[POS_SIGNATURE], tvb, 2, length, ENC_NA); return 2 + length; } @@ -888,7 +872,6 @@ dissect_payload_t(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pro int offset = 0; int len = 0; - tvb_ensure_bytes_exist(tvb, offset+0, 2); ts_type = tvb_get_guint8(tvb, offset+1); if (tree) { @@ -922,7 +905,6 @@ dissect_payload_id(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pr guint8 type; guint16 length; - tvb_ensure_bytes_exist(tvb, offset+0, 4); type = tvb_get_guint8(tvb, offset+1); length = tvb_get_ntohs(tvb, offset+2); if (tree) { @@ -930,7 +912,6 @@ dissect_payload_id(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pr proto_tree_add_item(tree, hf_mikey[POS_ID_LEN], tvb, 2, 2, ENC_BIG_ENDIAN); } - tvb_ensure_bytes_exist(tvb, offset+4, length); if (tree) { proto_item* parent; proto_tree_add_item(tree, hf_mikey[POS_ID], tvb, 4, length, ENC_ASCII|ENC_NA); @@ -951,7 +932,6 @@ dissect_payload_idr(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, p guint8 type; guint16 length; - tvb_ensure_bytes_exist(tvb, offset+0, 5); type = tvb_get_guint8(tvb, offset+2); length = tvb_get_ntohs(tvb, offset+3); if (tree) { @@ -960,7 +940,6 @@ dissect_payload_idr(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, p proto_tree_add_item(tree, hf_mikey[POS_ID_LEN], tvb, 3, 2, ENC_BIG_ENDIAN); } - tvb_ensure_bytes_exist(tvb, offset+5, length); if (tree) { proto_item *parent; proto_tree_add_item(tree, hf_mikey[POS_ID], tvb, 5, length, ENC_ASCII|ENC_NA); @@ -985,7 +964,6 @@ dissect_payload_cert(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo, prot asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - tvb_ensure_bytes_exist(tvb, offset+0, 4); type = tvb_get_guint8(tvb, offset+1); length = tvb_get_ntohs(tvb, offset+2); @@ -1013,12 +991,9 @@ dissect_payload_v(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pro guint16 length; guint8 alg; - tvb_ensure_bytes_exist(tvb, offset+0, 2); alg = tvb_get_guint8(tvb, offset+1); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_V_AUTH_ALG], tvb, 1, 1, ENC_BIG_ENDIAN); - } + proto_tree_add_item(tree, hf_mikey[POS_V_AUTH_ALG], tvb, 1, 1, ENC_BIG_ENDIAN); switch (alg) { case MAC_NULL: @@ -1031,10 +1006,7 @@ dissect_payload_v(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pro return 0; } - tvb_ensure_bytes_exist(tvb, offset+2, length); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_V_DATA], tvb, 2, length, ENC_NA); - } + proto_tree_add_item(tree, hf_mikey[POS_V_DATA], tvb, 2, length, ENC_NA); return 2 + length; } @@ -1047,10 +1019,8 @@ dissect_payload_sp_param(enum sp_prot_t proto, tvbuff_t *tvb, proto_tree *tree) guint8 length; int hfindex; - tvb_ensure_bytes_exist(tvb, offset+0, 2); type = tvb_get_guint8(tvb, offset+0); length = tvb_get_guint8(tvb, offset+1); - tvb_ensure_bytes_exist(tvb, offset+2, length); /* Default */ hfindex = hf_mikey[POS_SP_PARAM_F]; @@ -1092,7 +1062,6 @@ dissect_payload_sp(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, pr guint8 no; enum sp_prot_t type; - tvb_ensure_bytes_exist(tvb, offset+0, 5); length = tvb_get_ntohs(tvb, offset+3); no = tvb_get_guint8(tvb, offset+1); type = (enum sp_prot_t)tvb_get_guint8(tvb, offset+2); @@ -1136,26 +1105,17 @@ dissect_payload_rand(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, int offset = 0; guint16 length; - tvb_ensure_bytes_exist(tvb, offset+0, 2); length = tvb_get_guint8(tvb, offset+1); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_RAND_LEN], tvb, 1, 1, ENC_BIG_ENDIAN); - } - - tvb_ensure_bytes_exist(tvb, offset+2, length); + proto_tree_add_item(tree, hf_mikey[POS_RAND_LEN], tvb, 1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mikey[POS_RAND], tvb, 2, length, ENC_NA); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_RAND], tvb, 2, length, ENC_NA); - } return 2 + length; } static int dissect_payload_err(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { - tvb_ensure_bytes_exist(tvb, 0, 4); - if (tree) { proto_item *parent; guint8 err_no; @@ -1178,12 +1138,10 @@ dissect_payload_keydata(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U guint8 kv_type; offset = 0; - tvb_ensure_bytes_exist(tvb, 0, 4); key_type = tvb_get_guint8(tvb, 1) >> 4; kv_type = tvb_get_guint8(tvb, 1) & 0x0f; data_len = tvb_get_ntohs(tvb, 2); - tvb_ensure_bytes_exist(tvb, 4, data_len); offset += 4; if (tree) { @@ -1202,14 +1160,10 @@ dissect_payload_keydata(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U /* Dissect SALT key */ if ((key_type == KD_TGK_SALT) || (key_type == KD_TEK_SALT)) { guint16 salt_len; - tvb_ensure_bytes_exist(tvb, offset, 2); salt_len = tvb_get_ntohs(tvb, offset); if (salt_len > 0) { - tvb_ensure_bytes_exist(tvb, offset+2, salt_len); - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_KEY_SALT_LEN], tvb, offset, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_mikey[POS_KEY_SALT], tvb, offset+2, salt_len, ENC_NA); - } + proto_tree_add_item(tree, hf_mikey[POS_KEY_SALT_LEN], tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mikey[POS_KEY_SALT], tvb, offset+2, salt_len, ENC_NA); } offset += 2+salt_len; } @@ -1219,31 +1173,25 @@ dissect_payload_keydata(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U guint16 kv_from_len; guint16 kv_to_len; - tvb_ensure_bytes_exist(tvb, offset, 1); kv_from_len = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_mikey[POS_KEY_KV_FROM_LEN], tvb, offset, 1, ENC_BIG_ENDIAN); if (kv_from_len > 0) { - tvb_ensure_bytes_exist(tvb, offset+1, kv_from_len); proto_tree_add_item(tree, hf_mikey[POS_KEY_KV_FROM], tvb, offset+1, kv_from_len, ENC_NA); } offset += 1+kv_from_len; - tvb_ensure_bytes_exist(tvb, offset, 1); kv_to_len = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_mikey[POS_KEY_KV_TO_LEN], tvb, offset, 1, ENC_BIG_ENDIAN); if (kv_to_len > 0) { - tvb_ensure_bytes_exist(tvb, offset+1, kv_to_len); proto_tree_add_item(tree, hf_mikey[POS_KEY_KV_TO], tvb, offset+1, kv_to_len, ENC_NA); } offset += 1+kv_to_len; } else if (kv_type == KV_SPI) { guint16 kv_spi_len; - tvb_ensure_bytes_exist(tvb, offset, 1); kv_spi_len = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_mikey[POS_KEY_KV_SPI_LEN], tvb, offset, 1, ENC_BIG_ENDIAN); if (kv_spi_len > 0) { - tvb_ensure_bytes_exist(tvb, offset+1, kv_spi_len); proto_tree_add_item(tree, hf_mikey[POS_KEY_KV_SPI], tvb, offset+1, kv_spi_len, ENC_NA); } offset += 1+kv_spi_len; @@ -1259,7 +1207,6 @@ dissect_payload_general_ext(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinf guint8 type; guint16 data_len; - tvb_ensure_bytes_exist(tvb, offset+0, 4); type = tvb_get_guint8(tvb, offset+1); data_len = tvb_get_ntohs(tvb, offset+2); @@ -1268,8 +1215,6 @@ dissect_payload_general_ext(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinf proto_tree_add_item(tree, hf_mikey[POS_GENERAL_EXT_LEN], tvb, 2, 2, ENC_BIG_ENDIAN); } - tvb_ensure_bytes_exist(tvb, offset+3, data_len); - if (tree) { proto_item *parent; @@ -1291,7 +1236,6 @@ dissect_payload_sakke(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, int offset = 0; guint16 data_len; - tvb_ensure_bytes_exist(tvb, offset+0, 5); data_len = tvb_get_ntohs(tvb, offset+3); if (tree) { @@ -1300,11 +1244,7 @@ dissect_payload_sakke(mikey_t *mikey _U_, tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree_add_item(tree, hf_mikey[POS_SAKKE_LEN], tvb, 3, 2, ENC_BIG_ENDIAN); } - tvb_ensure_bytes_exist(tvb, offset+5, data_len); - - if (tree) { - proto_tree_add_item(tree, hf_mikey[POS_SAKKE_DATA], tvb, 5, data_len, ENC_NA); - } + proto_tree_add_item(tree, hf_mikey[POS_SAKKE_DATA], tvb, 5, data_len, ENC_NA); return 5 + data_len; } diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index 6d80907f66..896eeeb527 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -803,13 +803,10 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, } else { length += 1; } - if (tree) { - tvb_ensure_bytes_exist(tvb, offset - 1, length + 1); - proto_tree_add_string(mmse_tree, + proto_tree_add_string(mmse_tree, hf_mmse_content_location, tvb, offset - 1, length + 1, "<Undecoded value for m-mbox-delete-conf>"); - } } else { length = get_text_string(tvb, offset, &strval); if (tree) { @@ -828,11 +825,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tval = get_long_integer(tvb, offset, &count); tmptime.secs = tval; tmptime.nsecs = 0; - if (tree) { - tvb_ensure_bytes_exist(tvb, offset - 1, count + 1); - proto_tree_add_time(mmse_tree, hf_mmse_date, tvb, + proto_tree_add_time(mmse_tree, hf_mmse_date, tvb, offset - 1, count + 1, &tmptime); - } } offset += count; break; @@ -860,7 +854,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tmptime.secs = tval; tmptime.nsecs = 0; - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x80) proto_tree_add_time(mmse_tree, hf_mmse_delivery_time_abs, @@ -890,7 +883,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tmptime.secs = tval; tmptime.nsecs = 0; - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x80) proto_tree_add_time(mmse_tree, hf_mmse_expiry_abs, tvb, offset - 1, @@ -910,7 +902,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, length = get_value_length(tvb, offset, &count); if (tree) { field = tvb_get_guint8(tvb, offset + count); - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x81) { proto_tree_add_string(mmse_tree, hf_mmse_from, tvb, offset-1, length + count + 1, @@ -1124,7 +1115,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tmptime.secs = tval; tmptime.nsecs = 0; - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x80) proto_tree_add_time(mmse_tree, hf_mmse_reply_charging_deadline_abs, tvb, offset - 1, @@ -1205,7 +1195,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, strval = abs_time_to_str(wmem_packet_scope(), &tmptime, ABSOLUTE_TIME_LOCAL, TRUE); /* Now render the fields */ - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); tii = proto_tree_add_string_format(mmse_tree, hf_mmse_prev_sent_date, tvb, offset - 1, 1 + count + length, diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index c1fff15bcd..1f5cf8f7b1 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -2222,7 +2222,6 @@ objectidentifier(tvbuff_t* tvb, proto_tree *ndps_tree, int foffset) foffset += 1; length = tvb_get_guint8(tvb, foffset); foffset += 1; - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(atree, hf_ndps_oid, tvb, foffset, length, ENC_NA); foffset += length; } @@ -2468,7 +2467,6 @@ credentials(tvbuff_t* tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffse foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(atree, hf_ndps_password, tvb, foffset, length, ENC_NA); } proto_item_set_end(aitem, tvb, foffset); @@ -2480,7 +2478,6 @@ credentials(tvbuff_t* tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffse foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_certified, tvb, foffset, length, ENC_NA); } foffset += length; @@ -3809,7 +3806,6 @@ attribute_value(tvbuff_t* tvb, packet_info* pinfo, proto_tree *ndps_tree, int fo foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_octet_string, tvb, foffset, length, ENC_NA); } foffset += length; @@ -3818,7 +3814,6 @@ attribute_value(tvbuff_t* tvb, packet_info* pinfo, proto_tree *ndps_tree, int fo foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_octet_string, tvb, foffset, length, ENC_NA); } foffset += length; @@ -3831,7 +3826,6 @@ attribute_value(tvbuff_t* tvb, packet_info* pinfo, proto_tree *ndps_tree, int fo foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_octet_string, tvb, foffset, length, ENC_NA); } foffset += length; @@ -3851,7 +3845,6 @@ attribute_value(tvbuff_t* tvb, packet_info* pinfo, proto_tree *ndps_tree, int fo foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_octet_string, tvb, foffset, length, ENC_NA); } foffset += length; @@ -3874,7 +3867,6 @@ attribute_value(tvbuff_t* tvb, packet_info* pinfo, proto_tree *ndps_tree, int fo foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_octet_string, tvb, foffset, length, ENC_NA); } foffset += length; @@ -4861,7 +4853,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, ENC_NA); } foffset += length; @@ -5452,7 +5443,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, ENC_NA); } foffset += length; @@ -5496,7 +5486,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_guid, tvb, foffset, length, ENC_NA); } foffset += length; @@ -5617,7 +5606,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, ENC_NA); } foffset += length; @@ -5679,7 +5667,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(atree, hf_ndps_item_bytes, tvb, foffset, length, ENC_NA); } foffset += length; @@ -5796,7 +5783,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, ENC_NA); } foffset += length; @@ -6015,7 +6001,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, ENC_NA); } foffset += length; @@ -6193,7 +6178,6 @@ dissect_ndps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, g foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_context, tvb, foffset, length, ENC_NA); } foffset += length; @@ -7229,7 +7213,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, ENC_NA); } foffset += length; @@ -7334,7 +7317,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, ENC_NA); } foffset += length; @@ -7408,7 +7390,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(atree, hf_ndps_attribute_set, tvb, foffset, length, ENC_NA); } proto_item_set_end(aitem, tvb, foffset); @@ -7443,7 +7424,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, ENC_NA); } foffset += length; @@ -7469,7 +7449,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, ENC_NA); } foffset += length; @@ -7510,7 +7489,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(atree, hf_ndps_attribute_set, tvb, foffset, length, ENC_NA); } proto_item_set_end(aitem, tvb, foffset); @@ -7590,7 +7568,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_continuation_option, tvb, foffset, length, ENC_NA); } foffset += length; @@ -7703,7 +7680,6 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset += 4; if (length!=0) { - tvb_ensure_bytes_exist(tvb, foffset, length); proto_tree_add_item(ndps_tree, hf_ndps_attribute_set, tvb, foffset, length, ENC_NA); } break; diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index e69d53ef67..24898be450 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -7744,7 +7744,6 @@ dissect_nfs4_dirlist(tvbuff_t *tvb, int offset, packet_info *pinfo, int start_off = offset; /* Make sure we have 16 bytes (value follows + cookie + name length) */ - tvb_ensure_bytes_exist(tvb, offset, 16); name_len = tvb_get_ntohl(tvb, offset + 12); tvb_ensure_bytes_exist(tvb, offset, 16 + name_len); /* diff --git a/epan/dissectors/packet-rx.c b/epan/dissectors/packet-rx.c index b8956fc807..a934be7a9a 100644 --- a/epan/dissectors/packet-rx.c +++ b/epan/dissectors/packet-rx.c @@ -233,7 +233,6 @@ dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, offset, 4, tl); offset += 4; - tvb_ensure_bytes_exist(tvb, offset, tl); proto_tree_add_item(tree, hf_rx_ticket, tvb, offset, tl, ENC_NA); offset += tl; } diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 730bd2b073..a890f8f6bc 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -925,7 +925,6 @@ static int dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, pr bc = bc_remaining; \ } \ if (bc) { \ - tvb_ensure_bytes_exist(tvb, offset, bc); \ proto_tree_add_text(tree, tvb, offset, bc, \ "Extra byte parameters"); \ } \ @@ -2308,10 +2307,7 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int BYTE_COUNT; - if (tree) { - tvb_ensure_bytes_exist(tvb, offset, bc); - tr = proto_tree_add_subtree(tree, tvb, offset, bc, ett_smb_dialects, NULL, "Requested Dialects"); - } + tr = proto_tree_add_subtree(tree, tvb, offset, bc, ett_smb_dialects, NULL, "Requested Dialects"); if (!pinfo->fd->flags.visited && si->sip) { dialects = wmem_new(wmem_file_scope(), struct negprot_dialects); @@ -2411,7 +2407,6 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in "%u: %s", dialect, dialect_name); break; default: - tvb_ensure_bytes_exist(tvb, offset, wc*2); proto_tree_add_text(tree, tvb, offset, wc*2, "Words for unknown response format"); offset += wc*2; @@ -9137,7 +9132,6 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo, DISSECTOR_ASSERT(si); if (parent_tree) { - tvb_ensure_bytes_exist(tvb, offset, len); if (nti != NULL) { tree = proto_tree_add_subtree_format(parent_tree, tvb, offset, len, ett_smb_nt_trans_data, NULL, "%s Data", @@ -9225,7 +9219,6 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, nti = NULL; if (parent_tree) { - tvb_ensure_bytes_exist(tvb, offset, len); if (nti != NULL) { tree = proto_tree_add_subtree_format(parent_tree, tvb, offset, len, ett_smb_nt_trans_param, NULL, "%s Parameters", @@ -9435,7 +9428,6 @@ dissect_nt_trans_setup_response(tvbuff_t *tvb, packet_info *pinfo _U_, nti = NULL; if (parent_tree) { - tvb_ensure_bytes_exist(tvb, offset, len); if (nti != NULL) { /*item = */proto_tree_add_text(parent_tree, tvb, offset, len, "%s Setup", @@ -13888,7 +13880,6 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, si->unicode, &an_len, FALSE, FALSE, &bc); if (an == NULL) goto endofcommand; - tvb_ensure_bytes_exist(tvb, offset, an_len); proto_tree_add_string(tree, hf_smb_trans_name, tvb, offset, an_len, an); COUNT_BYTES(an_len); @@ -13911,7 +13902,6 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, padcnt = po-offset; if (padcnt > bc) padcnt = bc; - tvb_ensure_bytes_exist(tvb, offset, padcnt); proto_tree_add_item(tree, hf_smb_padding, tvb, offset, padcnt, ENC_NA); COUNT_BYTES(padcnt); } @@ -13940,7 +13930,6 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, padcnt = od-offset; if (padcnt > bc) padcnt = bc; - tvb_ensure_bytes_exist(tvb, offset, padcnt); proto_tree_add_item(tree, hf_smb_padding, tvb, offset, padcnt, ENC_NA); COUNT_BYTES(padcnt); } diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index ff2efe34b8..2cc69a7824 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -4927,7 +4927,6 @@ ssl_dissect_hnd_hello_ext_npn(ssl_common_dissect_t *hf, tvbuff_t *tvb, ext_len--; if (npn_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, npn_length); proto_tree_add_item(npn_tree, hf->hf.hs_ext_npn_str, tvb, offset, npn_length, ENC_ASCII|ENC_NA); offset += npn_length; @@ -4957,7 +4956,6 @@ ssl_dissect_hnd_hello_ext_reneg_info(ssl_common_dissect_t *hf, tvbuff_t *tvb, offset += 1; if (reneg_info_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, reneg_info_length); proto_tree_add_text(reneg_info_tree, tvb, offset, reneg_info_length, "Renegotiation Info"); offset += reneg_info_length; } @@ -4997,7 +4995,6 @@ ssl_dissect_hnd_hello_ext_server_name(ssl_common_dissect_t *hf, tvbuff_t *tvb, ext_len -= 2; if (server_name_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, server_name_length); proto_tree_add_item(server_name_tree, hf->hf.hs_ext_server_name, tvb, offset, server_name_length, ENC_ASCII|ENC_NA); offset += server_name_length; @@ -5780,7 +5777,6 @@ ssl_dissect_hnd_hello_ext_elliptic_curves(ssl_common_dissect_t *hf, tvbuff_t *tv tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - tvb_ensure_bytes_exist(tvb, offset, curves_length); ti = proto_tree_add_none_format(tree, hf->hf.hs_ext_elliptic_curves, tvb, offset, curves_length, @@ -5815,7 +5811,6 @@ ssl_dissect_hnd_hello_ext_ec_point_formats(ssl_common_dissect_t *hf, tvbuff_t *t tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - tvb_ensure_bytes_exist(tvb, offset, ecpf_length); ti = proto_tree_add_none_format(tree, hf->hf.hs_ext_elliptic_curves, tvb, offset, ecpf_length, diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 68487b299d..7a68c63e58 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -2615,7 +2615,6 @@ dissect_ssl2_hnd_client_hello(tvbuff_t *tvb, packet_info *pinfo, if (tree) { /* tell the user how many cipher specs they've won */ - tvb_ensure_bytes_exist(tvb, offset, cipher_spec_length); ti = proto_tree_add_none_format(tree, dissect_ssl3_hf.hf.hs_cipher_suites, tvb, offset, cipher_spec_length, "Cipher Specs (%u specs)", @@ -2642,16 +2641,12 @@ dissect_ssl2_hnd_client_hello(tvbuff_t *tvb, packet_info *pinfo, /* if there's a session id, show it */ if (session_id_length > 0) { - if (tree) - { - tvb_ensure_bytes_exist(tvb, offset, session_id_length); - proto_tree_add_bytes_format(tree, + proto_tree_add_bytes_format(tree, dissect_ssl3_hf.hf.hs_session_id, tvb, offset, session_id_length, NULL, "Session ID (%u byte%s)", session_id_length, plurality(session_id_length, "", "s")); - } /* PAOLO: get session id and reset session state for key [re]negotiation */ if (ssl) @@ -2667,10 +2662,7 @@ dissect_ssl2_hnd_client_hello(tvbuff_t *tvb, packet_info *pinfo, /* if there's a challenge, show it */ if (challenge_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, challenge_length); - - if (tree) - proto_tree_add_item(tree, hf_ssl2_handshake_challenge, + proto_tree_add_item(tree, hf_ssl2_handshake_challenge, tvb, offset, challenge_length, ENC_NA); if (ssl) { @@ -2745,7 +2737,6 @@ dissect_pct_msg_client_hello(tvbuff_t *tvb, offset += 2; if (CH_CIPHER_SPECS_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CH_CIPHER_SPECS_LENGTH); CH_CIPHER_SPECS_ti = proto_tree_add_item(tree, hf_pct_handshake_cipher_spec, tvb, offset, CH_CIPHER_SPECS_LENGTH, ENC_NA); CH_CIPHER_SPECS_tree = proto_item_add_subtree(CH_CIPHER_SPECS_ti, ett_pct_cipher_suites); @@ -2760,7 +2751,6 @@ dissect_pct_msg_client_hello(tvbuff_t *tvb, } if (CH_HASH_SPECS_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CH_HASH_SPECS_LENGTH); CH_HASH_SPECS_ti = proto_tree_add_item(tree, hf_pct_handshake_hash_spec, tvb, offset, CH_HASH_SPECS_LENGTH, ENC_NA); CH_HASH_SPECS_tree = proto_item_add_subtree(CH_HASH_SPECS_ti, ett_pct_hash_suites); @@ -2771,7 +2761,6 @@ dissect_pct_msg_client_hello(tvbuff_t *tvb, } if (CH_CERT_SPECS_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CH_CERT_SPECS_LENGTH); CH_CERT_SPECS_ti = proto_tree_add_item(tree, hf_pct_handshake_cert_spec, tvb, offset, CH_CERT_SPECS_LENGTH, ENC_NA); CH_CERT_SPECS_tree = proto_item_add_subtree(CH_CERT_SPECS_ti, ett_pct_cert_suites); @@ -2782,7 +2771,6 @@ dissect_pct_msg_client_hello(tvbuff_t *tvb, } if (CH_EXCH_SPECS_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CH_EXCH_SPECS_LENGTH); CH_EXCH_SPECS_ti = proto_tree_add_item(tree, hf_pct_handshake_exch_spec, tvb, offset, CH_EXCH_SPECS_LENGTH, ENC_NA); CH_EXCH_SPECS_tree = proto_item_add_subtree(CH_EXCH_SPECS_ti, ett_pct_exch_suites); @@ -2793,7 +2781,6 @@ dissect_pct_msg_client_hello(tvbuff_t *tvb, } if (CH_KEY_ARG_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CH_KEY_ARG_LENGTH); proto_tree_add_text(tree, tvb, offset, CH_KEY_ARG_LENGTH, "IV data (%d bytes)", CH_KEY_ARG_LENGTH); } } @@ -2889,19 +2876,16 @@ dissect_pct_msg_server_hello(tvbuff_t *tvb, proto_tree *tree, guint32 offset, pa } if (SH_CERT_SPECS_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, SH_CERT_SPECS_LENGTH); proto_tree_add_text(tree, tvb, offset, SH_CERT_SPECS_LENGTH, "Client CERT_SPECS (%d bytes)", SH_CERT_SPECS_LENGTH); offset += SH_CERT_SPECS_LENGTH; } if (SH_CLIENT_SIG_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, SH_CLIENT_SIG_LENGTH); proto_tree_add_text(tree, tvb, offset, SH_CLIENT_SIG_LENGTH, "Client Signature (%d bytes)", SH_CLIENT_SIG_LENGTH); offset += SH_CLIENT_SIG_LENGTH; } if (SH_RESPONSE_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, SH_RESPONSE_LENGTH); proto_tree_add_text(tree, tvb, offset, SH_RESPONSE_LENGTH, "Server Response (%d bytes)", SH_RESPONSE_LENGTH); } @@ -2946,32 +2930,26 @@ dissect_pct_msg_client_master_key(tvbuff_t *tvb, proto_tree *tree, guint32 offse offset += 2; if (CMK_CLEAR_KEY_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CMK_CLEAR_KEY_LENGTH); proto_tree_add_text(tree, tvb, offset, CMK_CLEAR_KEY_LENGTH, "Clear Key data (%d bytes)", CMK_CLEAR_KEY_LENGTH); offset += CMK_CLEAR_KEY_LENGTH; } if (CMK_ENCRYPTED_KEY_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CMK_ENCRYPTED_KEY_LENGTH); proto_tree_add_text(tree, tvb, offset, CMK_ENCRYPTED_KEY_LENGTH, "Encrypted Key data (%d bytes)", CMK_ENCRYPTED_KEY_LENGTH); offset += CMK_ENCRYPTED_KEY_LENGTH; } if (CMK_KEY_ARG_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CMK_KEY_ARG_LENGTH); proto_tree_add_text(tree, tvb, offset, CMK_KEY_ARG_LENGTH, "IV data (%d bytes)", CMK_KEY_ARG_LENGTH); offset += CMK_KEY_ARG_LENGTH; } if (CMK_VERIFY_PRELUDE) { - tvb_ensure_bytes_exist(tvb, offset, CMK_VERIFY_PRELUDE); proto_tree_add_text(tree, tvb, offset, CMK_VERIFY_PRELUDE, "Verify Prelude data (%d bytes)", CMK_VERIFY_PRELUDE); offset += CMK_VERIFY_PRELUDE; } if (CMK_CLIENT_CERT_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CMK_CLIENT_CERT_LENGTH); proto_tree_add_text(tree, tvb, offset, CMK_CLIENT_CERT_LENGTH, "Client Certificate data (%d bytes)", CMK_CLIENT_CERT_LENGTH); offset += CMK_CLIENT_CERT_LENGTH; } if (CMK_RESPONSE_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, CMK_RESPONSE_LENGTH); proto_tree_add_text(tree, tvb, offset, CMK_RESPONSE_LENGTH, "Response data (%d bytes)", CMK_RESPONSE_LENGTH); } } @@ -2993,7 +2971,6 @@ dissect_pct_msg_server_verify(tvbuff_t *tvb, offset += 2; if (SV_RESPONSE_LENGTH) { - tvb_ensure_bytes_exist(tvb, offset, SV_RESPONSE_LENGTH); proto_tree_add_text(tree, tvb, offset, SV_RESPONSE_LENGTH, "Server Response (%d bytes)", SV_RESPONSE_LENGTH); } } @@ -3083,7 +3060,6 @@ dissect_ssl2_hnd_client_master_key(tvbuff_t *tvb, /* show the variable length fields */ if (clear_key_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, clear_key_length); proto_tree_add_item(tree, hf_ssl2_handshake_clear_key, tvb, offset, clear_key_length, ENC_NA); offset += clear_key_length; @@ -3091,7 +3067,6 @@ dissect_ssl2_hnd_client_master_key(tvbuff_t *tvb, if (encrypted_key_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, encrypted_key_length); proto_tree_add_item(tree, hf_ssl2_handshake_enc_key, tvb, offset, encrypted_key_length, ENC_NA); offset += encrypted_key_length; @@ -3099,7 +3074,6 @@ dissect_ssl2_hnd_client_master_key(tvbuff_t *tvb, if (key_arg_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, key_arg_length); proto_tree_add_item(tree, hf_ssl2_handshake_key_arg, tvb, offset, key_arg_length, ENC_NA); } @@ -3192,7 +3166,6 @@ dissect_ssl2_hnd_server_hello(tvbuff_t *tvb, if (cipher_spec_length > 0) { /* provide a collapsing node for the cipher specs */ - tvb_ensure_bytes_exist(tvb, offset, cipher_spec_length); ti = proto_tree_add_none_format(tree, dissect_ssl3_hf.hf.hs_cipher_suites, tvb, offset, cipher_spec_length, @@ -3217,7 +3190,6 @@ dissect_ssl2_hnd_server_hello(tvbuff_t *tvb, if (connection_id_length > 0) { - tvb_ensure_bytes_exist(tvb, offset, connection_id_length); proto_tree_add_item(tree, hf_ssl2_handshake_connection_id, tvb, offset, connection_id_length, ENC_NA); } diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index 38c0642e2d..b624866871 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -1794,7 +1794,6 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) if (val_id >= 0x20 && val_id <=0x7E) { /* OK! */ val_str = (gchar *)tvb_get_stringz_enc(wmem_packet_scope(), tvb, val_start, (gint *)&val_len, ENC_ASCII); offset = val_start + val_len; - tvb_ensure_bytes_exist(tvb, hdr_start, offset-hdr_start); proto_tree_add_text(wsp_headers,tvb,hdr_start,offset-hdr_start, "%s: %s", hdr_str, val_str); } else { @@ -1830,7 +1829,6 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) } offset = tvb_len; } - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); hidden_item = proto_tree_add_string(wsp_headers, hf_hdr_name, tvb, hdr_start, offset - hdr_start, hdr_str); PROTO_ITEM_SET_HIDDEN(hidden_item); @@ -1960,12 +1958,10 @@ add_headers (proto_tree *tree, tvbuff_t *tvb, int hf, packet_info *pinfo) proto_item_append_text(ti, \ " <Error: Invalid header value>"); \ } else if (hf > 0) { /* Create protocol tree item */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ proto_tree_add_string(tree, hf, \ tvb, hdr_start, offset - hdr_start, \ " <Error: Invalid header value>"); \ } else { /* Create anonymous header field entry */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, \ "%s: <Error: Invalid header value>", \ val_to_str_ext (hdr_id, &vals_field_names_ext, \ @@ -1987,19 +1983,16 @@ wkh_default(proto_tree *tree, tvbuff_t *tvb, ok = TRUE; /* Bypass error checking as we don't parse the values! */ wkh_1_WellKnownValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_text (tree, tvb, hdr_start, offset - hdr_start, "%s: (Undecoded well-known value 0x%02x)", val_to_str_ext (hdr_id, &vals_field_names_ext, "<Unknown WSP header field 0x%02X>"), val_id & 0x7F); wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, "%s: %s", val_to_str_ext (hdr_id, &vals_field_names_ext, "<Unknown WSP header field 0x%02X>"), val_str); wkh_3_ValueWithLength; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_text (tree, tvb, hdr_start, offset - hdr_start, "%s: (Undecoded value in general form with length indicator)", val_to_str_ext (hdr_id, &vals_field_names_ext, @@ -2021,7 +2014,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i proto_tree *parameter_tree = NULL; \ \ wkh_1_WellKnownValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext(val_id & 0x7F, &vals_content_types_ext, \ @@ -2031,12 +2023,10 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i /* Sometimes with a No-Content response, a NULL content type \ * is reported. Process this correctly! */ \ if (*val_str) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_str); \ } else { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ "<no content type has been specified>"); \ @@ -2049,14 +2039,12 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i get_extension_media(val_str, tvb, off, len, ok); \ if (ok) { \ off += len; /* off now points to 1st byte after string */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string (tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ } \ } else if (is_integer_value(peek)) { \ get_integer_value(val, tvb, off, len, ok); \ if (ok) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext(val, &vals_content_types_ext, \ @@ -2137,7 +2125,6 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, DebugLog(("add_content_type() - Well-known - Start\n")); *textual_content = val_to_str_ext(val_id & 0x7F, &vals_content_types_ext, "<Unknown media type identifier 0x%X>"); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, *textual_content); @@ -2149,14 +2136,12 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, /* Sometimes with a No-Content response, a NULL content type * is reported. Process this correctly! */ if (*val_str) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, val_str); *textual_content = g_strdup(val_str); *well_known_content = 0; } else { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, "<no media type has been specified>"); @@ -2174,7 +2159,6 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, get_extension_media(val_str, tvb, off, len, ok); if (ok) { off += len; /* off now points to 1st byte after string */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string (tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, val_str); } @@ -2187,7 +2171,6 @@ add_content_type(proto_tree *tree, tvbuff_t *tvb, guint32 val_start, if (ok) { *textual_content = val_to_str_ext(val, &vals_content_types_ext, "<Unknown media type identifier 0x%X>"); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_type, tvb, hdr_start, offset - hdr_start, *textual_content); @@ -2226,14 +2209,12 @@ wkh_ ## underscored (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_ proto_tree *parameter_tree = NULL; \ \ wkh_1_WellKnownValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext(val_id & 0x7F, valueStringExtAddr, \ "<Unknown " valueName " identifier 0x%X>")); \ ok = TRUE; \ wkh_2_TextualValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ ok = TRUE; \ @@ -2244,14 +2225,12 @@ wkh_ ## underscored (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_ get_token_text(val_str, tvb, off, len, ok); \ if (ok) { \ off += len; /* off now points to 1st byte after string */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string (tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ } \ } else if (is_integer_value(peek)) { \ get_integer_value(val, tvb, off, len, ok); \ if (ok) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext(val, valueStringExtAddr, \ @@ -2296,7 +2275,6 @@ wkh_push_flag(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *p proto_tree *subtree = NULL; wkh_1_WellKnownValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_push_flag, tvb, hdr_start, offset - hdr_start, ""); subtree = proto_item_add_subtree(ti, ett_header); @@ -2342,7 +2320,6 @@ static guint32 wkh_profile_diff_wbxml (proto_tree *tree, tvbuff_t *tvb, wkh_2_TextualValueInv; /* Invalid */ wkh_3_ValueWithLength; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_profile_diff, tvb, hdr_start, offset - hdr_start, "(Profile-Diff value as WBXML)"); subtree = proto_item_add_subtree(ti, ett_header); @@ -2365,7 +2342,6 @@ wkh_allow(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *apinf wkh_1_WellKnownValue; val_id &= 0x7F; if (val_id >= 0x40) { /* Valid WSP method */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_allow, tvb, hdr_start, offset - hdr_start, val_to_str_ext(val_id & 0x7F, &wsp_vals_pdu_type_ext, @@ -2392,7 +2368,6 @@ wkh_public(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *apin wkh_1_WellKnownValue; val_id &= 0x7F; if (val_id >= 0x40) { /* Valid WSP method */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_public, tvb, hdr_start, offset - hdr_start, val_to_str_ext(val_id & 0x7F, &wsp_vals_pdu_type_ext, @@ -2400,7 +2375,6 @@ wkh_public(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *apin ok = TRUE; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_public, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2420,14 +2394,12 @@ wkh_vary(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo wkh_0_Declarations; wkh_1_WellKnownValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_vary, tvb, hdr_start, offset - hdr_start, val_to_str_ext(val_id & 0x7F, &vals_field_names_ext, "<Unknown WSP header field 0x%02X>")); ok = TRUE; wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_vary, tvb, hdr_start, offset - hdr_start, val_str); @@ -2448,7 +2420,6 @@ wkh_x_wap_security(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_in wkh_1_WellKnownValue; if (val_id == 0x80) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_x_wap_security, tvb, hdr_start, offset - hdr_start, "close-subordinate"); ok = TRUE; @@ -2471,13 +2442,11 @@ wkh_connection(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info * wkh_1_WellKnownValue; if (val_id == 0x80) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_connection, tvb, hdr_start, offset - hdr_start, "close"); ok = TRUE; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_connection, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2497,13 +2466,11 @@ wkh_transfer_encoding(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet wkh_1_WellKnownValue; if (val_id == 0x80) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_transfer_encoding, tvb, hdr_start, offset - hdr_start, "chunked"); ok = TRUE; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_transfer_encoding, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2524,20 +2491,17 @@ wkh_accept_ranges(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf wkh_1_WellKnownValue; switch (val_id) { case 0x80: /* none */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_ranges, tvb, hdr_start, offset - hdr_start, "none"); ok = TRUE; break; case 0x81: /* bytes */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_ranges, tvb, hdr_start, offset - hdr_start, "bytes"); ok = TRUE; break; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_ranges, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2558,26 +2522,22 @@ wkh_content_encoding(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_ wkh_1_WellKnownValue; switch (val_id) { case 0x80: /* gzip */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_encoding, tvb, hdr_start, offset - hdr_start, "gzip"); ok = TRUE; break; case 0x81: /* compress */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_encoding, tvb, hdr_start, offset - hdr_start, "compress"); ok = TRUE; break; case 0x82: /* deflate */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_encoding, tvb, hdr_start, offset - hdr_start, "deflate"); ok = TRUE; break; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_encoding, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2605,32 +2565,27 @@ wkh_accept_encoding(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i wkh_1_WellKnownValue; switch (val_id) { case 0x80: /* gzip */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "gzip"); ok = TRUE; break; case 0x81: /* compress */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "compress"); ok = TRUE; break; case 0x82: /* deflate */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "deflate"); ok = TRUE; break; case 0x83: /* * */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "*"); ok = TRUE; break; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2640,25 +2595,21 @@ wkh_accept_encoding(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i if (is_short_integer(peek)) { switch (peek) { case 0x80: /* gzip */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "gzip"); ok = TRUE; break; case 0x81: /* compress */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "compress"); ok = TRUE; break; case 0x82: /* deflate */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "deflate"); ok = TRUE; break; case 0x83: /* any */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, "*"); ok = TRUE; @@ -2668,7 +2619,6 @@ wkh_accept_encoding(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i } else { get_token_text(str, tvb, off, len, ok); if (ok) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_accept_encoding, tvb, hdr_start, offset - hdr_start, str); } @@ -2713,19 +2663,16 @@ wkh_content_disposition(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, pack if (is_short_integer(peek)) { switch (peek) { case 0x80: /* form-data */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_disposition, tvb, hdr_start, offset - hdr_start, "form-data"); ok = TRUE; break; case 0x81: /* attachment */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_disposition, tvb, hdr_start, offset - hdr_start, "attachment"); ok = TRUE; break; case 0x82: /* inline */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_disposition, tvb, hdr_start, offset - hdr_start, "inline"); ok = TRUE; @@ -2735,7 +2682,6 @@ wkh_content_disposition(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, pack } else { get_token_text(str, tvb, off, len, ok); if (ok) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_disposition, tvb, hdr_start, offset - hdr_start, str); } @@ -2765,7 +2711,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i wkh_1_WellKnownValue; \ /* Invalid */ \ wkh_2_TextualValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ ok = TRUE; \ @@ -2812,11 +2757,9 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i } else { /* OK (no trailing quote) */ \ str = wmem_strdup_printf(wmem_packet_scope(), "%s\"", val_str); \ } \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ } else { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ proto_item_append_text(ti, \ @@ -2846,7 +2789,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i wkh_1_WellKnownValue; \ /* Invalid */ \ wkh_2_TextualValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ ok = TRUE; \ @@ -2855,7 +2797,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i get_date_value(val, tvb, off, len, ok); \ if (ok) { \ str = abs_time_secs_to_str(wmem_packet_scope(), val, ABSOLUTE_TIME_LOCAL, TRUE); \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ /* BEHOLD: do NOT try to free str, as \ @@ -2890,7 +2831,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i get_date_value(val, tvb, off, len, ok); \ if (ok) { \ str = abs_time_secs_to_str(wmem_packet_scope(), val, ABSOLUTE_TIME_LOCAL, TRUE); \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ /* BEHOLD: do NOT try to free str, as \ @@ -2919,7 +2859,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i \ wkh_1_WellKnownValue; \ if (val_id == 0x80) { /* Openwave TOD header uses this format */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ "Requesting Time Of Day"); \ @@ -2937,13 +2876,11 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i get_date_value(val, tvb, off, len, ok); \ if (ok) { \ if (val == 0) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ "Requesting Time Of Day"); \ } else { \ str = abs_time_secs_to_str(wmem_packet_scope(), val, ABSOLUTE_TIME_LOCAL, TRUE); \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ } \ @@ -2967,7 +2904,6 @@ wkh_age(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _ wkh_1_WellKnownValue; val = val_id & 0x7F; val_str = wmem_strdup_printf(wmem_packet_scope(), "%u second%s", val, plurality(val, "", "s")); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_age, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -2978,7 +2914,6 @@ wkh_age(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _ get_long_integer(val, tvb, off, len, ok); if (ok) { val_str = wmem_strdup_printf(wmem_packet_scope(), "%u second%s", val, plurality(val, "", "s")); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_age, tvb, hdr_start, offset - hdr_start, val_str); } @@ -2998,14 +2933,12 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i guint32 off = val_start, len; \ \ wkh_1_WellKnownValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext(val_id & 0x7F, valueStringExtAddr, \ "(Unknown " valueName " identifier 0x%X)")); \ ok = TRUE; \ wkh_2_TextualValue; \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ ok = TRUE; \ @@ -3014,7 +2947,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i len = tvb_get_guint8(tvb,off); \ ok = (len >= 1 && len <= 4); /* Valid lengths for us are 1-4 */ \ if (ok) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext(val_id & 0x7F, valueStringExtAddr, \ @@ -3066,7 +2998,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, \ off = val_start + val_len_len; \ peek = tvb_get_guint8(tvb, off); \ if (peek == 0x80) { /* Basic */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, "basic"); \ subtree = proto_item_add_subtree(ti, ett_header); \ @@ -3086,11 +3017,9 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, \ } else { /* Authentication-scheme: token-text */ \ get_token_text(str, tvb, off, len, ok); \ if (ok) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, off - hdr_start, str); \ subtree = proto_item_add_subtree(ti, ett_header); \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ proto_tree_add_string(subtree, \ hf_hdr_ ## underscored ## _scheme, \ tvb, hdr_start, off - hdr_start, str); \ @@ -3145,7 +3074,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, \ off = val_start + val_len_len; \ peek = tvb_get_guint8(tvb, off); \ if (peek == 0x80) { /* Basic */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, "basic"); \ subtree = proto_item_add_subtree(ti, ett_header); \ @@ -3175,7 +3103,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, \ } else { /* Authentication-scheme: token-text */ \ get_token_text(str, tvb, off, len, ok); \ if (ok) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, off - hdr_start, str); \ subtree = proto_item_add_subtree(ti, ett_header); \ @@ -3232,7 +3159,6 @@ wkh_content_md5 (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info tvb_get_guint8(tvb, off + 14), tvb_get_guint8(tvb, off + 15) ); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_md5, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -3252,7 +3178,6 @@ wkh_pragma(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinf wkh_1_WellKnownValue; if (val_id == 0x80) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_pragma, tvb, hdr_start, offset - hdr_start, "no-cache"); ok = TRUE; @@ -3261,7 +3186,6 @@ wkh_pragma(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinf /* Invalid */ wkh_3_ValueWithLength; off = val_start + val_len_len; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_pragma, tvb, hdr_start, off - hdr_start, ""); /* NULL subtree for parameter() results in no subtree @@ -3286,7 +3210,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i \ wkh_1_WellKnownValue; \ str = wmem_strdup_printf(wmem_packet_scope(), "%u", val_id & 0x7F); \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ ok = TRUE; \ @@ -3297,7 +3220,6 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i get_long_integer(val, tvb, off, len, ok); \ if (ok) { \ str = wmem_strdup_printf(wmem_packet_scope(), "%u", val); \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, str); \ } \ @@ -3319,12 +3241,10 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i wkh_1_WellKnownValue; \ val_str = try_val_to_str_ext(val_id & 0x7F, valueStringExtAddr); \ if (val_str) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ ok = TRUE; \ } else { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ "<Unknown " valueName ">"); \ @@ -3338,12 +3258,10 @@ wkh_ ## underscored(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i if (ok) { \ val_str = try_val_to_str_ext(val_id & 0x7F, valueStringExtAddr); \ if (val_str) { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, val_str); \ ok = TRUE; \ } else { \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ ti = proto_tree_add_string(tree, hf_hdr_ ## underscored, \ tvb, hdr_start, offset - hdr_start, \ "<Unknown " valueName ">"); \ @@ -3372,13 +3290,11 @@ wkh_cache_control(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf val = val_id & 0x7F; val_str = try_val_to_str_ext(val, &vals_cache_control_ext); if (val_str) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_cache_control, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; } wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_cache_control, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -3396,7 +3312,6 @@ wkh_cache_control(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf switch (cache_control_directive & 0x7F) { case CACHE_CONTROL_NO_CACHE: case CACHE_CONTROL_PRIVATE: - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_cache_control, tvb, hdr_start, offset - hdr_start, val_to_str_ext (cache_control_directive & 0x7F, &vals_cache_control_ext, @@ -3424,7 +3339,6 @@ wkh_cache_control(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf case CACHE_CONTROL_MAX_STALE: case CACHE_CONTROL_MIN_FRESH: case CACHE_CONTROL_S_MAXAGE: - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_cache_control, tvb, hdr_start, offset - hdr_start, val_to_str_ext (cache_control_directive & 0x7F, &vals_cache_control_ext, @@ -3444,7 +3358,6 @@ wkh_cache_control(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf } else if (is_token_text(cache_control_directive)) { get_token_text(val_str, tvb, off, len, ok); if (ok) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_cache_control, tvb, hdr_start, offset - hdr_start, val_str); get_integer_value(val, tvb, off, len, ok); @@ -3495,7 +3408,6 @@ wkh_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pin val = val_id & 0x7F; val_str = try_val_to_str_ext(val, &vals_wsp_warning_code_ext); if (val_str) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_warning, tvb, hdr_start, offset - hdr_start, val_str); subtree = proto_item_add_subtree(ti, ett_header); @@ -3514,7 +3426,6 @@ wkh_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pin val_str = try_val_to_str_ext(val, &vals_wsp_warning_code_short_ext); if (val_str) { /* OK */ str = wmem_strdup_printf(wmem_packet_scope(), "code=%s", val_str); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_warning, tvb, hdr_start, offset - hdr_start, str); subtree = proto_item_add_subtree(ti, ett_header); @@ -3561,7 +3472,6 @@ wkh_profile_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i val = val_id & 0x7F; val_str = try_val_to_str_ext(val, &vals_wsp_profile_warning_code_ext); if (val_str) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_profile_warning, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -3574,7 +3484,6 @@ wkh_profile_warning(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_i if (warn_code & 0x80) { /* Well known warn code */ val_str = try_val_to_str_ext(val, &vals_wsp_profile_warning_code_ext); if (val_str) { /* OK */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_profile_warning, tvb, hdr_start, offset - hdr_start, val_str); get_uri_value(str, tvb, off, len, ok); @@ -3619,12 +3528,10 @@ static guint32 wkh_encoding_version (proto_tree *tree, tvbuff_t *tvb, wkh_1_WellKnownValue; val = val_id & 0x7F; val_str = wmem_strdup_printf(wmem_packet_scope(), "%u.%u", val >> 4, val & 0x0F); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); proto_tree_add_string(tree, hf_hdr_encoding_version, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); proto_tree_add_string(tree, hf_hdr_encoding_version, tvb, hdr_start, offset - hdr_start, val_str); ok = TRUE; @@ -3633,7 +3540,6 @@ static guint32 wkh_encoding_version (proto_tree *tree, tvbuff_t *tvb, val = tvb_get_guint8(tvb, off); if (val & 0x80) { /* Header Code Page */ val_str = wmem_strdup_printf(wmem_packet_scope(), "code-page=%u", val & 0x7F); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_encoding_version, tvb, hdr_start, offset - hdr_start, val_str); off++; @@ -3670,7 +3576,6 @@ wkh_content_range(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf get_uintvar_integer (val, tvb, off, len, ok); /* Uintvar start */ if (ok) { val_str = wmem_strdup_printf(wmem_packet_scope(), "first-byte-pos=%u", val); - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_content_range, tvb, hdr_start, offset - hdr_start, val_str); subtree = proto_item_add_subtree(ti, ett_header); @@ -3717,7 +3622,6 @@ wkh_range(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo off = val_start + val_len_len; val = tvb_get_guint8(tvb, off); if (val == 0x80) { /* Byte-range */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_range, tvb, hdr_start, offset - hdr_start, "byte-range"); subtree = proto_item_add_subtree(ti, ett_header); @@ -3742,7 +3646,6 @@ wkh_range(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo } } } else if (val == 0x81) { /* Suffix-byte-range */ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_range, tvb, hdr_start, offset - hdr_start, "suffix-byte-range"); subtree = proto_item_add_subtree(ti, ett_header); @@ -3771,7 +3674,6 @@ static guint32 wkh_te (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packe wkh_1_WellKnownValue; if (val_id == 0x81) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); proto_tree_add_string(tree, hf_hdr_encoding_version, tvb, hdr_start, offset - hdr_start, "trailers"); ok = TRUE; @@ -3784,7 +3686,6 @@ static guint32 wkh_te (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packe if (val & 0x80) { /* Well-known-TE */ val_str = try_val_to_str_ext((val & 0x7F), &vals_well_known_te_ext); if (val_str) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_te, tvb, hdr_start, off - hdr_start, val_str); off++; @@ -3793,7 +3694,6 @@ static guint32 wkh_te (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packe } else { /* TE in Token-text format */ get_token_text(val_str, tvb, off, len, ok); if (ok) { - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_string(tree, hf_hdr_te, tvb, hdr_start, off - hdr_start, val_str); off += len; @@ -3820,7 +3720,6 @@ static guint32 wkh_te (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packe */ #undef wkh_1_WellKnownValue #define wkh_1_WellKnownValue /* Parse Well Known Value */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ hidden_item = proto_tree_add_string(tree, hf_hdr_name, \ tvb, hdr_start, offset - hdr_start, \ val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, \ @@ -3846,12 +3745,10 @@ static guint32 wkh_te (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packe proto_item_append_text(ti, \ "<Error: Invalid header value>"); \ } else if (hf > 0) { /* Create protocol tree item */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ proto_tree_add_string(tree, hf, \ tvb, hdr_start, offset - hdr_start, \ " <Error: Invalid header value>"); \ } else { /* Create anonymous header field entry */ \ - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); \ proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, \ "%s: <Error: Invalid header value>", \ val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, \ @@ -3870,19 +3767,16 @@ wkh_openwave_default(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_ ok = TRUE; /* Bypass error checking as we don't parse the values! */ wkh_1_WellKnownValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, "%s: (Undecoded well-known value 0x%02x)", val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, "<Unknown WSP header field 0x%02X>"), val_id & 0x7F); wkh_2_TextualValue; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_text(tree,tvb,hdr_start, offset - hdr_start, "%s: %s", val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, "<Unknown WSP header field 0x%02X>"), val_str); wkh_3_ValueWithLength; - tvb_ensure_bytes_exist(tvb, hdr_start, offset - hdr_start); ti = proto_tree_add_text(tree, tvb, hdr_start, offset - hdr_start, "%s: (Undecoded value in general form with length indicator)", val_to_str_ext (hdr_id, &vals_openwave_field_names_ext, @@ -4062,12 +3956,10 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) if (is_quoted_string(val_str[0])) { /* Add trailing quote! */ if (is_quoted_string(val_str[val_len-2])) { /* Trailing quote - issue a warning */ - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "%s: %s" TrailingQuoteWarning, str, val_str); s = wmem_strdup_printf(wmem_packet_scope(), "; %s=%s", str, val_str); } else { /* OK (no trailing quote) */ - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "%s: %s\"", str, val_str); s = wmem_strdup_printf(wmem_packet_scope(), "; %s=%s\"", str, val_str); @@ -4075,7 +3967,6 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) } else { /* Token-text | 0x00 */ /* TODO - verify that it is either Token-text or 0x00 * and flag with warning if invalid */ - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "%s: %s", str, val_str); s = wmem_strdup_printf(wmem_packet_scope(), "; %s=%s", str, val_str); @@ -4091,7 +3982,6 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) get_integer_value (val,tvb,offset,val_len,ok); if (ok) { /* Also found a valid integer parameter value: val */ offset += val_len; - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "%s: %u", str, val); s = wmem_strdup_printf(wmem_packet_scope(), "; %s=%u", str, val); @@ -4101,7 +3991,6 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) * protocol tree for the untyped parameter case */ } else { /* Error: neither token-text not Integer-value */ DebugLog(("Invalid untyped parameter value!\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text (tree, tvb, start, offset - start, "<Error: Invalid untyped parameter definition>"); offset = start + len; /* Skip to end of buffer */ @@ -4117,7 +4006,6 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) DebugLog(("parameter() - Typed - Start\n")); get_integer_value (type,tvb,start,type_len,ok); if (!ok) { - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text (tree, tvb, start, offset - start, "<Error: Invalid typed parameter definition>"); return (start + len); /* Skip to end of buffer */ @@ -4194,7 +4082,6 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) } /* Else: invalid parameter value */ } if (ok) { - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_string (tree, hf_wsp_parameter_upart_type, tvb, start, offset - start, val_str); str = wmem_strdup_printf(wmem_packet_scope(), "; type=%s", val_str); @@ -4314,56 +4201,48 @@ parameter (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start, int len) case 0x07: /* WSP 1.1 encoding - Differences: Field-name */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Differences - decoding stopped"); break; case 0x08: /* WSP 1.1 encoding - Padding: Short-integer */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Padding - decoding stopped"); break; case 0x0E: /* WSP 1.3 encoding - Max-Age: Delta-seconds-value */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Max-Age - decoding stopped"); break; case 0x10: /* WSP 1.3 encoding - Secure: No-value */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Secure - decoding stopped"); break; case 0x13: /* WSP 1.4 encoding - Creation-date: Date-value */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Creation-Date - decoding stopped"); break; case 0x14: /* WSP 1.4 encoding - Modification-date: Date-value */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Modification-Date - decoding stopped"); break; case 0x15: /* WSP 1.4 encoding - Read-date: Date-value */ DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter Read-Date - decoding stopped"); break; default: DebugLog(("Skipping remaining parameters from here\n")); - tvb_ensure_bytes_exist(tvb, start, offset - start); proto_tree_add_text(tree, tvb, start, offset - start, "Undecoded parameter type 0x%02x - decoding stopped", type); @@ -4873,7 +4752,6 @@ dissect_sir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb, offset, len, val_len); offset += len; /* ProvURL */ - tvb_ensure_bytes_exist(tvb, offset, val_len); proto_tree_add_item (tree, hf_sir_prov_url, tvb, offset, val_len, ENC_ASCII|ENC_NA); offset += val_len; @@ -5413,7 +5291,6 @@ add_uri (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, proto_tree_add_uint (tree, hf_wsp_header_uri_len, tvb, URILenOffset, count, uriLen); - tvb_ensure_bytes_exist(tvb, URIOffset, uriLen); proto_tree_add_item (tree, hf_wsp_header_uri, tvb, URIOffset, uriLen, ENC_ASCII|ENC_NA); @@ -5886,7 +5763,6 @@ add_multipart_data (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo) DataLen = tvb_get_guintvar (tvb, offset, &count); offset += count; - tvb_ensure_bytes_exist(tvb, part_start, HeadersLen + DataLen + (offset - part_start)); ti = proto_tree_add_uint(sub_tree, hf_wsp_mpart, tvb, part_start, HeadersLen + DataLen + (offset - part_start), partnr); mpart_tree = proto_item_add_subtree(ti, ett_multiparts); |