aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dns.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2017-07-29 13:12:19 +0200
committerMichael Mann <mmann78@netscape.net>2017-07-29 14:17:06 +0000
commitf461a3a743750421ec377357687f65c2c007a63a (patch)
treeb75f437d298a6873e140c2215837cf2c85ce22a6 /epan/dissectors/packet-dns.c
parent168065dad763121f9f9630cac9aed184098d53a4 (diff)
DNS: Fix APL record IPv4 address presentation
When getting the (partial) IPv4 address make sure to pass the full 32 bits of the address when adding the proto tree item. Bug: 13923 Change-Id: I5b849705e723efd1269a64ee28b8d93724ab769a Reviewed-on: https://code.wireshark.org/review/22838 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dns.c')
-rw-r--r--epan/dissectors/packet-dns.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 44d2084cf6..4309c97b41 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -791,8 +791,6 @@ static const value_string hip_algo_vals[] = {
};
/* RFC 3123 */
-#define TAPL_ADDR_FAMILY_IPV4 (AFNUM_INET)
-#define TAPL_ADDR_FAMILY_IPV6 (AFNUM_INET6)
#define DNS_APL_NEGATION (1<<7)
#define DNS_APL_AFDLENGTH (0x7F<<0)
@@ -2824,12 +2822,12 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
cur_offset += 1;
rr_len -= 1;
- if (afamily == 1 && afdpart_len <= 4) { /* IPv4 */
- addr_copy = (guint8 *)wmem_alloc0(wmem_file_scope(), 4);
+ if (afamily == AFNUM_INET && afdpart_len <= 4) {
+ addr_copy = (guint8 *)wmem_alloc0(wmem_packet_scope(), 4);
tvb_memcpy(tvb, (guint8 *)addr_copy, cur_offset, afdpart_len);
- proto_tree_add_ipv4(rr_tree, hf_dns_apl_afdpart_ipv4, tvb, cur_offset, afdpart_len, *addr_copy);
- } else if (afamily == 2 && afdpart_len <= 16) { /* IPv6 */
- addr_copy = (guint8 *)wmem_alloc0(wmem_file_scope(), 16);
+ proto_tree_add_ipv4(rr_tree, hf_dns_apl_afdpart_ipv4, tvb, cur_offset, afdpart_len, *(guint32*)addr_copy);
+ } else if (afamily == AFNUM_INET6 && afdpart_len <= 16) {
+ addr_copy = (guint8 *)wmem_alloc0(wmem_packet_scope(), 16);
tvb_memcpy(tvb, (guint8 *)addr_copy, cur_offset, afdpart_len);
proto_tree_add_ipv6(rr_tree, hf_dns_apl_afdpart_ipv6, tvb, cur_offset, afdpart_len, (struct e_in6_addr *)addr_copy);
} else { /* Other... */