aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/ldap/packet-ldap-template.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-01-04 15:53:56 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2017-01-19 09:31:37 +0000
commitc397adda8a7af8374ba1355f8c221f48abfac42a (patch)
tree6ebe3eb7204ceab9ffe93036f58066abcdc9bbab /epan/dissectors/asn1/ldap/packet-ldap-template.c
parenta056b685760340e2a3d83014f618ba567fc8355b (diff)
dns: change get_dns_name to return consumed bytes + actual name len.
Because of the DNS name encoding, the consumed bytes in the tvb and the length of the string of the dns name can be different. We need to handle them separately for the purpose they are. Moreover the name string can contain null bytes, then we can't rely on strlen() but we need the actual length. Subsequent calls to proto_tree_add_string() will require to pass the string to format_text() in order have non-printable characters printed. Bug: 13289 Change-Id: I6d0b295867ece265f8995f82da2c629992aeb703 Reviewed-on: https://code.wireshark.org/review/19539 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/asn1/ldap/packet-ldap-template.c')
-rw-r--r--epan/dissectors/asn1/ldap/packet-ldap-template.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/dissectors/asn1/ldap/packet-ldap-template.c b/epan/dissectors/asn1/ldap/packet-ldap-template.c
index f635be702a..d9caff5b6c 100644
--- a/epan/dissectors/asn1/ldap/packet-ldap-template.c
+++ b/epan/dissectors/asn1/ldap/packet-ldap-template.c
@@ -1308,10 +1308,11 @@ int dissect_mscldap_string(tvbuff_t *tvb, int offset, char *str, int max_len, gb
{
int compr_len;
const guchar *name;
+ guint name_len;
/* The name data MUST start at offset 0 of the tvb */
- compr_len = expand_dns_name(tvb, offset, max_len, 0, &name);
- g_strlcpy(str, name, max_len);
+ compr_len = get_dns_name(tvb, offset, max_len, 0, &name, &name_len);
+ g_strlcpy(str, name, name_len);
return offset + compr_len;
}