diff options
author | John Thacker <johnthacker@gmail.com> | 2022-12-01 08:23:51 -0500 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2022-12-01 08:23:51 -0500 |
commit | 8623cd97460c9239ea5389f5fedb6f3d62952682 (patch) | |
tree | 932ec90899b86c624ab9868b5fe50d95a5a323e1 | |
parent | f2a0d25dba1152f1f34c91cd2addab11c9c8b250 (diff) |
icmpv6: Format DNS name as UTF-8 for output
DNS names technically have arbitrary unknown encoding.
When adding them as a string for output, format as UTF-8.
Fix #18689
-rw-r--r-- | epan/dissectors/packet-icmpv6.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 80253fbcfc..f444b27ae8 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -2351,7 +2351,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree case ND_OPT_DNS_SEARCH_LIST: /* DNS Search List Option (31) */ { int dnssl_len; - const gchar *dnssl_name; + const gchar *dnssl_name, *name_out; /* Reserved */ proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_reserved, tvb, opt_offset, 2, ENC_NA); @@ -2370,8 +2370,9 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree break; } used_bytes = get_dns_name(tvb, opt_offset, 0, opt_offset, &dnssl_name, &dnssl_len); - proto_tree_add_string(icmp6opt_tree, hf_icmpv6_opt_dnssl, tvb, opt_offset, used_bytes, format_text(pinfo->pool, dnssl_name, dnssl_len)); - proto_item_append_text(ti, " %s", dnssl_name); + name_out = format_text(pinfo->pool, dnssl_name, dnssl_len); + proto_tree_add_string(icmp6opt_tree, hf_icmpv6_opt_dnssl, tvb, opt_offset, used_bytes, name_out); + proto_item_append_text(ti, " %s", name_out); opt_offset += used_bytes; } |