From c2a1d8feed0791478629c8dba775ec5f3bda7653 Mon Sep 17 00:00:00 2001 From: AndersBroman Date: Thu, 9 Apr 2015 14:36:26 +0200 Subject: [PATCH] Replace deprecated API tvb_length -> tvb_reported_length Change-Id: I9c8bf6beec47afb901e492723b335a28a24f455e Reviewed-on: https://code.wireshark.org/review/8004 Reviewed-by: Anders Broman --- asn1/dap/dap.cnf | 2 +- asn1/ftam/packet-ftam-template.c | 4 ++-- asn1/goose/goose.cnf | 2 +- asn1/inap/inap.cnf | 6 +++--- asn1/ldap/ldap.cnf | 30 +++++++++++++------------- asn1/ldap/packet-ldap-template.c | 4 ++-- asn1/mms/mms.cnf | 4 ++-- asn1/nbap/nbap.cnf | 4 ++-- asn1/p1/p1.cnf | 20 ++++++++--------- epan/dissectors/packet-dap.c | 2 +- epan/dissectors/packet-ftam.c | 4 ++-- epan/dissectors/packet-goose.c | 2 +- epan/dissectors/packet-inap.c | 6 +++--- epan/dissectors/packet-ldap.c | 34 ++++++++++++++--------------- epan/dissectors/packet-mms.c | 4 ++-- epan/dissectors/packet-nbap.c | 4 ++-- epan/dissectors/packet-p1.c | 37 ++++++++++++++++++++------------ 17 files changed, 89 insertions(+), 80 deletions(-) diff --git a/asn1/dap/dap.cnf b/asn1/dap/dap.cnf index 252bb08e8c..6e5ea08ca7 100644 --- a/asn1/dap/dap.cnf +++ b/asn1/dap/dap.cnf @@ -290,7 +290,7 @@ OPERATION.&ResultType %(DEFAULT_BODY)s if(out_tvb) { - len = tvb_length(out_tvb); + len = tvb_reported_length(out_tvb); /* now see if we can add a string representation */ for(i=0; ipinfo, ext_tree, NULL); }else{ call_dissector(data_handle, tvb, actx->pinfo, ext_tree); - offset = tvb_length_remaining(tvb,offset); + offset = tvb_reported_length_remaining(tvb,offset); } @@ -251,7 +251,7 @@ dissect_isup_called_party_number_parameter(parameter_tvb, tree, NULL); if (!parameter_tvb) return offset; - dissect_q931_bearer_capability_ie(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), tree); + dissect_q931_bearer_capability_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), tree); #.FN_BODY RedirectionInformation VAL_PTR = ¶meter_tvb @@ -296,7 +296,7 @@ dissect_isup_called_party_number_parameter(parameter_tvb, tree, NULL); return offset; subtree = proto_item_add_subtree(actx->created_item, ett_inap_HighLayerCompatibility); - dissect_q931_high_layer_compat_ie(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), subtree); + dissect_q931_high_layer_compat_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), subtree); #.FN_BODY Cause VAL_PTR = ¶meter_tvb /* diff --git a/asn1/ldap/ldap.cnf b/asn1/ldap/ldap.cnf index 464342248b..d0aab8b523 100644 --- a/asn1/ldap/ldap.cnf +++ b/asn1/ldap/ldap.cnf @@ -67,7 +67,7 @@ PasswordPolicyResponseValue B "1.3.6.1.4.1.42.2.27.8.5.1" "passwordPolicy" if (!parameter_tvb) return offset; - object_identifier_id = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); + object_identifier_id = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id); if(name){ @@ -172,7 +172,7 @@ char *mechanism = NULL; * different type and/or mechanism. */ if(!actx->pinfo->fd->flags.visited) { - mechanism = tvb_get_string_enc(NULL, parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); + mechanism = tvb_get_string_enc(NULL, parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */ /* * If the mechanism in this request is an empty string (which is @@ -210,7 +210,7 @@ gint32 tag; * All SPNEGO PDUs are of class CONSTRUCTED while * GSS PDUs are class APPLICATION */ - if (parameter_tvb && (tvb_length(parameter_tvb) > 0)) + if (parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree); } /*if ((ldap_info->auth_mech != NULL) && ((strcmp(ldap_info->auth_mech, "GSSAPI") == 0) || (ber_class==BER_CLASS_APP))) {*/ @@ -218,7 +218,7 @@ gint32 tag; /* * This is a raw GSS-API token. */ - if (parameter_tvb && (tvb_length(parameter_tvb) > 0)) { + if (parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) { call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree); } } @@ -274,7 +274,7 @@ ldap_conv_info_t *ldap_info; * which might not be wrapped in GSS-SPNEGO but be a raw * NTLMSSP blob */ - if ( (tvb_length(parameter_tvb)>=7) + if ( (tvb_reported_length(parameter_tvb)>=7) && (!tvb_memeql(parameter_tvb, 0, "NTLMSSP", 7))){ call_dissector(ntlmssp_handle, parameter_tvb, actx->pinfo, tree); break; @@ -282,14 +282,14 @@ ldap_conv_info_t *ldap_info; /* * This is a GSS-API token. */ - if(parameter_tvb && (tvb_length(parameter_tvb) > 0)) + if(parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree); } else if (ldap_info->auth_mech != NULL && strcmp(ldap_info->auth_mech, "GSSAPI") == 0) { /* * This is a GSS-API token. */ - if(parameter_tvb && (tvb_length(parameter_tvb) > 0)) + if(parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree); } break; @@ -308,7 +308,7 @@ ldap_conv_info_t *ldap_info; ldap_do_protocolop(actx->pinfo); if(parameter_tvb) - ldapstring = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_length_remaining(parameter_tvb, 0), ENC_UTF_8|ENC_NA); + ldapstring = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb, 0), ENC_UTF_8|ENC_NA); if(hf_index == hf_ldap_baseObject) { /* this is search - put it on the scanline */ @@ -461,7 +461,7 @@ ldap_conv_info_t *ldap_info; /* first check if we have a custom attribute type configured */ if ((hf_id = get_hf_for_header (attr_type)) != NULL) - proto_tree_add_item (tree, *hf_id, next_tvb, 0, tvb_length_remaining(next_tvb, 0), ENC_UTF_8|ENC_NA); + proto_tree_add_item (tree, *hf_id, next_tvb, 0, tvb_reported_length_remaining(next_tvb, 0), ENC_UTF_8|ENC_NA); /* if we have an attribute type that isn't binary see if there is a better dissector */ else if(!attr_type || !next_tvb || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, actx->pinfo, tree, NULL)) { @@ -470,14 +470,14 @@ ldap_conv_info_t *ldap_info; /* do the default thing */ %(DEFAULT_BODY)s - len = tvb_length_remaining(next_tvb, 0); + len = tvb_reported_length_remaining(next_tvb, 0); for(i = 0; i < len; i++) if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i))) break; if(i == len) { - string = tvb_get_string_enc(wmem_packet_scope(), next_tvb, 0, tvb_length_remaining(next_tvb, 0), ENC_ASCII|ENC_NA); + string = tvb_get_string_enc(wmem_packet_scope(), next_tvb, 0, tvb_reported_length_remaining(next_tvb, 0), ENC_ASCII|ENC_NA); proto_item_set_text(actx->created_item, "AttributeValue: %%s", string); } } @@ -690,14 +690,14 @@ offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &v ldap_do_protocolop(actx->pinfo); call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree); - offset+=tvb_length_remaining(tvb, offset); + offset+=tvb_reported_length_remaining(tvb, offset); #.FN_BODY AuthenticationChoice/ntlmsspAuth /* make sure the protocol op comes first */ ldap_do_protocolop(actx->pinfo); call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree); - offset+=tvb_length_remaining(tvb, offset); + offset+=tvb_reported_length_remaining(tvb, offset); #.FN_BODY BindResponse/_untag/matchedDN tvbuff_t *new_tvb=NULL; @@ -705,7 +705,7 @@ offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &v offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb); if( new_tvb - && (tvb_length(new_tvb)>=7) + && (tvb_reported_length(new_tvb)>=7) && (!tvb_memeql(new_tvb, 0, "NTLMSSP", 7))){ /* make sure the protocol op comes first */ @@ -772,7 +772,7 @@ offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &v dissect_ber_identifier(actx->pinfo, tree, tvb, otheroffset, &ber_class, &pc, &tag); otheroffset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); } else { - gint32 remaining=tvb_length_remaining(tvb, offset); + gint32 remaining=tvb_reported_length_remaining(tvb, offset); len=remaining>0 ? remaining : 0; } diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c index 2fae157d9b..c168f93839 100644 --- a/asn1/ldap/packet-ldap-template.c +++ b/asn1/ldap/packet-ldap-template.c @@ -912,7 +912,7 @@ dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo, one_more_pdu: - length_remaining = tvb_ensure_length_remaining(tvb, offset); + length_remaining = tvb_ensure_captured_length_remaining(tvb, offset); if (length_remaining < 6) return; @@ -1065,7 +1065,7 @@ static void } } - length_remaining = tvb_ensure_length_remaining(tvb, offset); + length_remaining = tvb_ensure_captured_length_remaining(tvb, offset); /* It might still be a packet containing a SASL security layer * but it's just that we never saw the BIND packet. diff --git a/asn1/mms/mms.cnf b/asn1/mms/mms.cnf index 9e2d2fb641..42cdc6434d 100644 --- a/asn1/mms/mms.cnf +++ b/asn1/mms/mms.cnf @@ -52,7 +52,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE gchar * ptime; nstime_t ts; - len = tvb_length_remaining(tvb, offset); + len = tvb_reported_length_remaining(tvb, offset); if(len == 4) { @@ -104,7 +104,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE nstime_t ts; gchar * ptime; - len = tvb_length_remaining(tvb, offset); + len = tvb_reported_length_remaining(tvb, offset); if(len != 8) { diff --git a/asn1/nbap/nbap.cnf b/asn1/nbap/nbap.cnf index 2c25819d05..0edba8646d 100644 --- a/asn1/nbap/nbap.cnf +++ b/asn1/nbap/nbap.cnf @@ -627,7 +627,7 @@ actx->pinfo->link_dir=P2P_DIR_UL; # TransportLayerAddress ::= BIT STRING (SIZE (1..160, ...)) # Assume 4 bytes used in case of IPv4 /* Get the length */ - tvb_len = tvb_length(parameter_tvb); + tvb_len = tvb_reported_length(parameter_tvb); subtree = proto_item_add_subtree(actx->created_item, ett_nbap_TransportLayerAddress); if (tvb_len==4){ /* IPv4 */ @@ -720,7 +720,7 @@ hsdsch_macdflow_ids[num_items-1] = hsdsch_macdflow_id; # -- the UDP port field is included in the first octet of the Binding ID. BindingID_port = tvb_get_ntohs(parameter_tvb,0); - if(tvb_length(parameter_tvb)==2){ + if(tvb_reported_length(parameter_tvb)==2){ proto_item_append_text(actx->created_item, " (%%u)",BindingID_port); } diff --git a/asn1/p1/p1.cnf b/asn1/p1/p1.cnf index 4ac72fd154..85244ded61 100644 --- a/asn1/p1/p1.cnf +++ b/asn1/p1/p1.cnf @@ -539,7 +539,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" if(actx->external.indirect_ref_present) { proto_item_append_text(tree, " (%%s)", val_to_str(actx->external.indirect_reference, p1_StandardExtension_vals, "standard-extension %%d")); if (dissector_try_uint(p1_extension_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { - offset = tvb_length(tvb); + offset = tvb_reported_length(tvb); } else { proto_item *item; proto_tree *next_tree; @@ -577,7 +577,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" proto_item_append_text(tree, " (%%s)", val_to_str(actx->external.indirect_reference, p1_ExtensionAttributeType_vals, "extension-attribute-type %%d")); if (dissector_try_uint(p1_extension_attribute_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { - offset =tvb_length(tvb); + offset =tvb_reported_length(tvb); } else { proto_item *item; proto_tree *next_tree; @@ -669,7 +669,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" /* we can do this now constructed octet strings are supported */ offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb); - proto_item_set_text(actx->created_item, "content (%%u bytes)", tvb_length (next_tvb)); + proto_item_set_text(actx->created_item, "content (%%u bytes)", tvb_reported_length (next_tvb)); if (next_tvb) { if (ctx && ctx->content_type_id) { @@ -679,7 +679,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" proto_tree *next_tree; item = proto_tree_add_expert(actx->subtree.top_tree ? actx->subtree.top_tree : tree, actx->pinfo, &ei_p1_unknown_built_in_content_type, - next_tvb, 0, tvb_length_remaining(tvb, offset)); + next_tvb, 0, tvb_reported_length_remaining(tvb, offset)); next_tree=proto_item_add_subtree(item, ett_p1_content_unknown); dissect_unknown_ber(actx->pinfo, next_tvb, 0, next_tree); @@ -698,10 +698,10 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" %(DEFAULT_BODY)s if (ctx && ctx->do_address) { - proto_item_append_text(actx->subtree.tree, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname))); + proto_item_append_text(actx->subtree.tree, " %%s", tvb_format_text(mtaname, 0, tvb_reported_length(mtaname))); } else { if (mtaname) { - col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname))); + col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", tvb_format_text(mtaname, 0, tvb_reported_length(mtaname))); } } @@ -1053,10 +1053,10 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" if(id) { if (ctx && ctx->do_address) - proto_item_append_text(actx->subtree.tree, " $ %%s)", tvb_format_text(id, 0, tvb_length(id))); + proto_item_append_text(actx->subtree.tree, " $ %%s)", tvb_format_text(id, 0, tvb_reported_length(id))); if (hf_index == hf_p1_subject_identifier) - col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %%s)", tvb_format_text(id, 0, tvb_length(id))); + col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %%s)", tvb_format_text(id, 0, tvb_reported_length(id))); } #.FN_BODY MTSIdentifier @@ -1125,7 +1125,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" %(DEFAULT_BODY)s if(arrival && ctx && ctx->do_address) - proto_item_append_text(actx->subtree.tree, " %%s", tvb_format_text(arrival, 0, tvb_length(arrival))); + proto_item_append_text(actx->subtree.tree, " %%s", tvb_format_text(arrival, 0, tvb_reported_length(arrival))); #.FN_PARS RoutingAction VAL_PTR = &action @@ -1173,7 +1173,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" proto_item_append_text(tree, " (%%s)", val_to_str(actx->external.indirect_reference, p1_TokenDataType_vals, "tokendata-type %%d")); if (dissector_try_uint(p1_tokendata_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { - offset = tvb_length(tvb); + offset = tvb_reported_length(tvb); } else { proto_item *item; proto_tree *next_tree; diff --git a/epan/dissectors/packet-dap.c b/epan/dissectors/packet-dap.c index 261f231fc5..a44b17259c 100644 --- a/epan/dissectors/packet-dap.c +++ b/epan/dissectors/packet-dap.c @@ -1573,7 +1573,7 @@ dissect_dap_T_pagedResultsQueryReference(gboolean implicit_tag _U_, tvbuff_t *tv if(out_tvb) { - len = tvb_length(out_tvb); + len = tvb_reported_length(out_tvb); /* now see if we can add a string representation */ for(i=0; ipinfo, ext_tree, NULL); }else{ call_dissector(data_handle, tvb, actx->pinfo, ext_tree); - offset = tvb_length_remaining(tvb,offset); + offset = tvb_reported_length_remaining(tvb,offset); } @@ -2211,7 +2211,7 @@ dissect_inap_T_bearerCap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse if (!parameter_tvb) return offset; - dissect_q931_bearer_capability_ie(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), tree); + dissect_q931_bearer_capability_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), tree); @@ -4576,7 +4576,7 @@ dissect_inap_HighLayerCompatibility(gboolean implicit_tag _U_, tvbuff_t *tvb _U_ return offset; subtree = proto_item_add_subtree(actx->created_item, ett_inap_HighLayerCompatibility); - dissect_q931_high_layer_compat_ie(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), subtree); + dissect_q931_high_layer_compat_ie(parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), subtree); diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index ffa3087e8a..270c8549d2 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -1149,7 +1149,7 @@ dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset ldap_do_protocolop(actx->pinfo); if(parameter_tvb) - ldapstring = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_length_remaining(parameter_tvb, 0), ENC_UTF_8|ENC_NA); + ldapstring = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb, 0), ENC_UTF_8|ENC_NA); if(hf_index == hf_ldap_baseObject) { /* this is search - put it on the scanline */ @@ -1285,7 +1285,7 @@ char *mechanism = NULL; * different type and/or mechanism. */ if(!actx->pinfo->fd->flags.visited) { - mechanism = tvb_get_string_enc(NULL, parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); + mechanism = tvb_get_string_enc(NULL, parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */ /* * If the mechanism in this request is an empty string (which is @@ -1334,7 +1334,7 @@ gint32 tag; * All SPNEGO PDUs are of class CONSTRUCTED while * GSS PDUs are class APPLICATION */ - if (parameter_tvb && (tvb_length(parameter_tvb) > 0)) + if (parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree); } /*if ((ldap_info->auth_mech != NULL) && ((strcmp(ldap_info->auth_mech, "GSSAPI") == 0) || (ber_class==BER_CLASS_APP))) {*/ @@ -1342,7 +1342,7 @@ gint32 tag; /* * This is a raw GSS-API token. */ - if (parameter_tvb && (tvb_length(parameter_tvb) > 0)) { + if (parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) { call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree); } } @@ -1379,7 +1379,7 @@ dissect_ldap_T_ntlmsspNegotiate(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in ldap_do_protocolop(actx->pinfo); call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree); - offset+=tvb_length_remaining(tvb, offset); + offset+=tvb_reported_length_remaining(tvb, offset); @@ -1395,7 +1395,7 @@ dissect_ldap_T_ntlmsspAuth(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off ldap_do_protocolop(actx->pinfo); call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree); - offset+=tvb_length_remaining(tvb, offset); + offset+=tvb_reported_length_remaining(tvb, offset); @@ -1560,7 +1560,7 @@ dissect_ldap_T_bindResponse_matchedDN(gboolean implicit_tag _U_, tvbuff_t *tvb _ offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb); if( new_tvb - && (tvb_length(new_tvb)>=7) + && (tvb_reported_length(new_tvb)>=7) && (!tvb_memeql(new_tvb, 0, "NTLMSSP", 7))){ /* make sure the protocol op comes first */ @@ -1665,7 +1665,7 @@ ldap_conv_info_t *ldap_info; * which might not be wrapped in GSS-SPNEGO but be a raw * NTLMSSP blob */ - if ( (tvb_length(parameter_tvb)>=7) + if ( (tvb_reported_length(parameter_tvb)>=7) && (!tvb_memeql(parameter_tvb, 0, "NTLMSSP", 7))){ call_dissector(ntlmssp_handle, parameter_tvb, actx->pinfo, tree); break; @@ -1673,14 +1673,14 @@ ldap_conv_info_t *ldap_info; /* * This is a GSS-API token. */ - if(parameter_tvb && (tvb_length(parameter_tvb) > 0)) + if(parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree); } else if (ldap_info->auth_mech != NULL && strcmp(ldap_info->auth_mech, "GSSAPI") == 0) { /* * This is a GSS-API token. */ - if(parameter_tvb && (tvb_length(parameter_tvb) > 0)) + if(parameter_tvb && (tvb_reported_length(parameter_tvb) > 0)) call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree); } break; @@ -2338,7 +2338,7 @@ dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of /* first check if we have a custom attribute type configured */ if ((hf_id = get_hf_for_header (attr_type)) != NULL) - proto_tree_add_item (tree, *hf_id, next_tvb, 0, tvb_length_remaining(next_tvb, 0), ENC_UTF_8|ENC_NA); + proto_tree_add_item (tree, *hf_id, next_tvb, 0, tvb_reported_length_remaining(next_tvb, 0), ENC_UTF_8|ENC_NA); /* if we have an attribute type that isn't binary see if there is a better dissector */ else if(!attr_type || !next_tvb || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, actx->pinfo, tree, NULL)) { @@ -2349,14 +2349,14 @@ dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of NULL); - len = tvb_length_remaining(next_tvb, 0); + len = tvb_reported_length_remaining(next_tvb, 0); for(i = 0; i < len; i++) if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i))) break; if(i == len) { - string = tvb_get_string_enc(wmem_packet_scope(), next_tvb, 0, tvb_length_remaining(next_tvb, 0), ENC_ASCII|ENC_NA); + string = tvb_get_string_enc(wmem_packet_scope(), next_tvb, 0, tvb_reported_length_remaining(next_tvb, 0), ENC_ASCII|ENC_NA); proto_item_set_text(actx->created_item, "AttributeValue: %s", string); } } @@ -2861,7 +2861,7 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U if (!parameter_tvb) return offset; - object_identifier_id = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); + object_identifier_id = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 0, tvb_reported_length_remaining(parameter_tvb,0), ENC_UTF_8|ENC_NA); name = oid_resolved_from_string(wmem_packet_scope(), object_identifier_id); if(name){ @@ -3409,7 +3409,7 @@ dissect_ldap_DirSyncFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs dissect_ber_identifier(actx->pinfo, tree, tvb, otheroffset, &ber_class, &pc, &tag); otheroffset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); } else { - gint32 remaining=tvb_length_remaining(tvb, offset); + gint32 remaining=tvb_reported_length_remaining(tvb, offset); len=remaining>0 ? remaining : 0; } @@ -3840,7 +3840,7 @@ dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo, one_more_pdu: - length_remaining = tvb_ensure_length_remaining(tvb, offset); + length_remaining = tvb_ensure_captured_length_remaining(tvb, offset); if (length_remaining < 6) return; @@ -3993,7 +3993,7 @@ static void } } - length_remaining = tvb_ensure_length_remaining(tvb, offset); + length_remaining = tvb_ensure_captured_length_remaining(tvb, offset); /* It might still be a packet containing a SASL security layer * but it's just that we never saw the BIND packet. diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c index 74cc6fdd63..c986a6ca5b 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -1840,7 +1840,7 @@ dissect_mms_TimeOfDay(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ gchar * ptime; nstime_t ts; - len = tvb_length_remaining(tvb, offset); + len = tvb_reported_length_remaining(tvb, offset); if(len == 4) { @@ -1921,7 +1921,7 @@ dissect_mms_UtcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ nstime_t ts; gchar * ptime; - len = tvb_length_remaining(tvb, offset); + len = tvb_reported_length_remaining(tvb, offset); if(len != 8) { diff --git a/epan/dissectors/packet-nbap.c b/epan/dissectors/packet-nbap.c index ecd4debd53..051e6c9250 100644 --- a/epan/dissectors/packet-nbap.c +++ b/epan/dissectors/packet-nbap.c @@ -8715,7 +8715,7 @@ dissect_nbap_BindingID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, return offset; BindingID_port = tvb_get_ntohs(parameter_tvb,0); - if(tvb_length(parameter_tvb)==2){ + if(tvb_reported_length(parameter_tvb)==2){ proto_item_append_text(actx->created_item, " (%u)",BindingID_port); } @@ -8740,7 +8740,7 @@ dissect_nbap_TransportLayerAddress(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t if (!parameter_tvb) return offset; /* Get the length */ - tvb_len = tvb_length(parameter_tvb); + tvb_len = tvb_reported_length(parameter_tvb); subtree = proto_item_add_subtree(actx->created_item, ett_nbap_TransportLayerAddress); if (tvb_len==4){ /* IPv4 */ diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c index 17bec5c4b8..5050a4cfe5 100644 --- a/epan/dissectors/packet-p1.c +++ b/epan/dissectors/packet-p1.c @@ -979,10 +979,10 @@ dissect_p1_MTAName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, if (ctx && ctx->do_address) { - proto_item_append_text(actx->subtree.tree, " %s", tvb_format_text(mtaname, 0, tvb_length(mtaname))); + proto_item_append_text(actx->subtree.tree, " %s", tvb_format_text(mtaname, 0, tvb_reported_length(mtaname))); } else { if (mtaname) { - col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", tvb_format_text(mtaname, 0, tvb_length(mtaname))); + col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", tvb_format_text(mtaname, 0, tvb_reported_length(mtaname))); } } @@ -1714,10 +1714,10 @@ dissect_p1_LocalIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off if(id) { if (ctx && ctx->do_address) - proto_item_append_text(actx->subtree.tree, " $ %s)", tvb_format_text(id, 0, tvb_length(id))); + proto_item_append_text(actx->subtree.tree, " $ %s)", tvb_format_text(id, 0, tvb_reported_length(id))); if (hf_index == hf_p1_subject_identifier) - col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %s)", tvb_format_text(id, 0, tvb_length(id))); + col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %s)", tvb_format_text(id, 0, tvb_reported_length(id))); } @@ -2200,7 +2200,7 @@ dissect_p1_T_extension_attribute_value(gboolean implicit_tag _U_, tvbuff_t *tvb proto_item_append_text(tree, " (%s)", val_to_str(actx->external.indirect_reference, p1_ExtensionAttributeType_vals, "extension-attribute-type %d")); if (dissector_try_uint(p1_extension_attribute_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { - offset =tvb_length(tvb); + offset =tvb_reported_length(tvb); } else { proto_item *item; proto_tree *next_tree; @@ -2666,7 +2666,7 @@ dissect_p1_Time(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, as if(arrival && ctx && ctx->do_address) - proto_item_append_text(actx->subtree.tree, " %s", tvb_format_text(arrival, 0, tvb_length(arrival))); + proto_item_append_text(actx->subtree.tree, " %s", tvb_format_text(arrival, 0, tvb_reported_length(arrival))); @@ -3045,7 +3045,7 @@ dissect_p1_ExtensionValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs if(actx->external.indirect_ref_present) { proto_item_append_text(tree, " (%s)", val_to_str(actx->external.indirect_reference, p1_StandardExtension_vals, "standard-extension %d")); if (dissector_try_uint(p1_extension_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { - offset = tvb_length(tvb); + offset = tvb_reported_length(tvb); } else { proto_item *item; proto_tree *next_tree; @@ -3227,7 +3227,7 @@ dissect_p1_Content(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, /* we can do this now constructed octet strings are supported */ offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb); - proto_item_set_text(actx->created_item, "content (%u bytes)", tvb_length (next_tvb)); + proto_item_set_text(actx->created_item, "content (%u bytes)", tvb_reported_length (next_tvb)); if (next_tvb) { if (ctx && ctx->content_type_id) { @@ -3237,7 +3237,7 @@ dissect_p1_Content(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, proto_tree *next_tree; item = proto_tree_add_expert(actx->subtree.top_tree ? actx->subtree.top_tree : tree, actx->pinfo, &ei_p1_unknown_built_in_content_type, - next_tvb, 0, tvb_length_remaining(tvb, offset)); + next_tvb, 0, tvb_reported_length_remaining(tvb, offset)); next_tree=proto_item_add_subtree(item, ett_p1_content_unknown); dissect_unknown_ber(actx->pinfo, next_tvb, 0, next_tree); @@ -7197,7 +7197,7 @@ dissect_p1_T_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, proto_item_append_text(tree, " (%s)", val_to_str(actx->external.indirect_reference, p1_TokenDataType_vals, "tokendata-type %d")); if (dissector_try_uint(p1_tokendata_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) { - offset = tvb_length(tvb); + offset = tvb_reported_length(tvb); } else { proto_item *item; proto_tree *next_tree; @@ -8637,6 +8637,8 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* dat } + + /*--- proto_register_p1 -------------------------------------------*/ void proto_register_p1(void) { @@ -10922,7 +10924,7 @@ void proto_register_p1(void) { NULL, HFILL }}, /*--- End of included file: packet-p1-hfarr.c ---*/ -#line 318 "../../asn1/p1/packet-p1-template.c" +#line 320 "../../asn1/p1/packet-p1-template.c" }; /* List of subtrees */ @@ -11121,7 +11123,7 @@ void proto_register_p1(void) { &ett_p1_SEQUENCE_SIZE_1_ub_recipients_OF_PerRecipientProbeSubmissionFields, /*--- End of included file: packet-p1-ettarr.c ---*/ -#line 331 "../../asn1/p1/packet-p1-template.c" +#line 333 "../../asn1/p1/packet-p1-template.c" }; static ei_register_info ei[] = { @@ -11170,7 +11172,7 @@ void proto_register_p1(void) { new_register_ber_syntax_dissector("ORName", proto_p1, dissect_ORName_PDU); /*--- End of included file: packet-p1-syn-reg.c ---*/ -#line 372 "../../asn1/p1/packet-p1-template.c" +#line 374 "../../asn1/p1/packet-p1-template.c" } @@ -11336,7 +11338,7 @@ void proto_reg_handoff_p1(void) { /*--- End of included file: packet-p1-dis-tab.c ---*/ -#line 380 "../../asn1/p1/packet-p1-template.c" +#line 382 "../../asn1/p1/packet-p1-template.c" /* APPLICATION CONTEXT */ @@ -11348,9 +11350,14 @@ void proto_reg_handoff_p1(void) { register_rtse_oid_dissector_handle("2.6.0.2.12", p1_handle, 0, "id-as-mta-rtse", TRUE); register_rtse_oid_dissector_handle("2.6.0.2.7", p1_handle, 0, "id-as-mtse", FALSE); + register_rtse_oid_dissector_handle("applicationProtocol.1", p1_handle, 0, "mts-transfer-protocol-1984", FALSE); register_rtse_oid_dissector_handle("applicationProtocol.12", p1_handle, 0, "mta-transfer-protocol", FALSE); + /* the ROS dissector will use the registered P3 ros info */ + register_rtse_oid_dissector_handle(id_as_mts_rtse, NULL, 0, "id-as-mts-rtse", TRUE); + register_rtse_oid_dissector_handle(id_as_msse, NULL, 0, "id-as-msse", TRUE); + /* remember the tpkt handler for change in preferences */ tpkt_handle = find_dissector("tpkt"); @@ -11363,6 +11370,7 @@ void proto_reg_handoff_p1(void) { /* Register P3 with ROS */ + register_ros_protocol_info(id_as_msse, &p3_ros_info, 0, "id-as-msse", FALSE); register_ros_protocol_info(id_as_mdse_88, &p3_ros_info, 0, "id-as-mdse-88", FALSE); @@ -11372,6 +11380,7 @@ void proto_reg_handoff_p1(void) { register_ros_protocol_info(id_as_mase_94, &p3_ros_info, 0, "id-as-mase-94", FALSE); register_ros_protocol_info(id_as_mts, &p3_ros_info, 0, "id-as-mts", FALSE); + register_ros_protocol_info(id_as_mts_rtse, &p3_ros_info, 0, "id-as-mts-rtse", TRUE); }