diff options
author | Jeremiejig <me@jeremiejig.fr> | 2020-02-11 22:59:28 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-02-15 21:19:09 +0000 |
commit | 18a7e64c85d80a479e289c01fa33740ac03e1d58 (patch) | |
tree | f1cd4c328e35200abf374be66687d0c3011eca5f /epan/dissectors/packet-dhcp.c | |
parent | c129c28d3af90b152b9f4b52975f9bcfecd998de (diff) |
get_dns_name: fixup some missing change introduced with c397adda8a7
Following commit c397adda8a7 there was some missing change
* Some `cur_offset += name_len` instead of `cur_offset += used_bytes`
* Some missing format_text
I took a look at the code after observing a bug with RRSIG record.
The signature in RRSIG was dissecting with some strange offset.
You can easily generate some pcap with those commands
delv @1.1.1.1 A www.cloudflare.com
and/or
dig @1.1.1.1 +dnssec www.cloudflare.com
Change-Id: Ibd6a6248b7497b8409d7797dc320035c8c2d1ed8
Reviewed-on: https://code.wireshark.org/review/36080
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-dhcp.c')
-rw-r--r-- | epan/dissectors/packet-dhcp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/epan/dissectors/packet-dhcp.c b/epan/dissectors/packet-dhcp.c index 2b79356c6e..c3f20804f0 100644 --- a/epan/dissectors/packet-dhcp.c +++ b/epan/dissectors/packet-dhcp.c @@ -2772,6 +2772,7 @@ static int dissect_dhcpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { int length = tvb_reported_length(tvb); + gchar *name_out; const gchar *dns_name; guint dns_name_len; @@ -2808,12 +2809,13 @@ dissect_dhcpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ /* use the get_dns_name method that manages all techniques of RFC 1035 (compression pointer and so on) */ consumedx = get_dns_name(rfc3396_dns_domain_search_list.tvb_composite, composite_offset, tvb_reported_length(rfc3396_dns_domain_search_list.tvb_composite), 0, &dns_name, &dns_name_len); + name_out = format_text(wmem_packet_scope(), dns_name, dns_name_len); if (rfc3396_dns_domain_search_list.total_number_of_block == 1) { /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */ - proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_fqdn, tvb, composite_offset, consumedx, dns_name); + proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_fqdn, tvb, composite_offset, consumedx, name_out); } else { /* RFC 3396 is used, so the option is split into several option 119. We don't link fqdn with v_tree. */ - proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_fqdn, tvb, 0, 0, dns_name); + proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_fqdn, tvb, 0, 0, name_out); } composite_offset += consumedx; } @@ -2829,6 +2831,7 @@ dissect_dhcpopt_sip_servers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int length = tvb_reported_length(tvb); const gchar *dns_name; guint dns_name_len; + gchar *name_out; /* Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4) (RFC 3396) */ /* Domain Names - Implementation And Specification (RFC 1035) */ @@ -2880,13 +2883,14 @@ dissect_dhcpopt_sip_servers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* use the get_dns_name method that manages all techniques of RFC 1035 (compression pointer and so on) */ consumedx = get_dns_name(rfc3396_sip_server.tvb_composite, composite_offset, tvb_reported_length(rfc3396_sip_server.tvb_composite), 1 /* ignore enc */, &dns_name, &dns_name_len); + name_out = format_text(wmem_packet_scope(), dns_name, dns_name_len); if (rfc3396_sip_server.total_number_of_block == 1) { /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */ - proto_tree_add_string(tree, hf_dhcp_option_sip_server_name, tvb, composite_offset, consumedx, dns_name); + proto_tree_add_string(tree, hf_dhcp_option_sip_server_name, tvb, composite_offset, consumedx, name_out); } else { /* RFC 3396 is used, so the option is split into several option 120. We don't link fqdn with v_tree. */ - proto_tree_add_string(tree, hf_dhcp_option_sip_server_name, tvb, 0, 0, format_text(wmem_packet_scope(), dns_name, dns_name_len)); + proto_tree_add_string(tree, hf_dhcp_option_sip_server_name, tvb, 0, 0, name_out); } composite_offset += consumedx; } |