]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix segfault in the dns64 module in the formaterror error path.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Oct 2015 09:02:01 +0000 (09:02 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Oct 2015 09:02:01 +0000 (09:02 +0000)
git-svn-id: file:///svn/unbound/trunk@3506 be551aaa-1e26-0410-a405-d3ace91eadb9

dns64/dns64.c
doc/Changelog
testdata/dns64_lookup.rpl

index 63cc8084e35f07f3231a650eeb64bcd9e5b1765d..0de3f664334191f25bd1412ff32624b8485a4829 100644 (file)
@@ -618,8 +618,10 @@ dns64_synth_aaaa_data(const struct ub_packed_rrset_key* fk,
        dd->rr_ttl = (time_t*)&dd->rr_data[dd->count];
        for(i = 0; i < fd->count; ++i) {
                if (fd->rr_len[i] != 6 || fd->rr_data[i][0] != 0
-                   || fd->rr_data[i][1] != 4)
+                   || fd->rr_data[i][1] != 4) {
+                       *dd_out = NULL;
                        return;
+               }
                dd->rr_len[i] = 18;
                dd->rr_data[i] =
                    (uint8_t*)&dd->rr_ttl[dd->count] + 18*i;
@@ -638,6 +640,7 @@ dns64_synth_aaaa_data(const struct ub_packed_rrset_key* fk,
         */
        if(!dk) {
                log_err("no key");
+               *dd_out = NULL;
                return;
        }
 
@@ -646,6 +649,7 @@ dns64_synth_aaaa_data(const struct ub_packed_rrset_key* fk,
 
        if(!dk->rk.dname) {
                log_err("out of memory");
+               *dd_out = NULL;
                return;
        }
 
index cfcae05670ee6f520f4b0b21b28630797f5bf4f1..29cf20d146cdba2fd454b3086a3c0bdecca946f7 100644 (file)
@@ -1,3 +1,6 @@
+15 October 2015: Wouter
+       - Fix segfault in the dns64 module in the formaterror error path.
+
 14 October 2015: Wouter
        - ANY responses include DNAME records if present, as per Evan Hunt's
          remark in dnsop.
index 5d4a63b3e73cf2c7c7fcca3d937cc3be7f8e86f5..49f26db89c7cd0fdbcefd37c0f77c8394105578e 100644 (file)
@@ -15,7 +15,7 @@ SCENARIO_BEGIN Test dns64 lookup and synthesis.
 ; AAAA if present, is passed through unchanged.
 
 ; K.ROOT-SERVERS.NET.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 200
        ADDRESS 193.0.14.129 
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -40,10 +40,23 @@ com.        IN NS   a.gtld-servers.net.
 SECTION ADDITIONAL
 a.gtld-servers.net.    IN      A       192.5.6.30
 ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode subdomain
+ADJUST copy_id copy_query
+REPLY QR NOERROR
+SECTION QUESTION
+7.6.5.in-addr.arpa. IN A
+SECTION AUTHORITY
+7.6.5.in-addr.arpa. IN NS ns.example.com.
+SECTION ADDITIONAL
+ns.example.com.                IN      A       1.2.3.4
+ENTRY_END
+
 RANGE_END
 
 ; a.gtld-servers.net.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 200
        ADDRESS 192.5.6.30
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -71,7 +84,7 @@ ENTRY_END
 RANGE_END
 
 ; ns.example.com.
-RANGE_BEGIN 0 100
+RANGE_BEGIN 0 200
        ADDRESS 1.2.3.4
 ENTRY_BEGIN
 MATCH opcode qtype qname
@@ -125,6 +138,33 @@ SECTION ADDITIONAL
 ns.example.com.                IN      A       1.2.3.4
 ENTRY_END
 
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+broken.example.com. IN AAAA
+SECTION ANSWER
+; NO AAAA present
+SECTION AUTHORITY
+example.com.   IN SOA  a. b. 1 2 3 4 5
+ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+broken.example.com. IN A
+SECTION ANSWER
+broken.example.com. IN A       5.6.7.8
+broken.example.com. IN A \# 3 030405
+SECTION AUTHORITY
+example.com.   IN NS   ns.example.com.
+SECTION ADDITIONAL
+ns.example.com.                IN      A       1.2.3.4
+ENTRY_END
+
 ENTRY_BEGIN
 MATCH opcode qtype qname
 ADJUST copy_id
@@ -138,6 +178,19 @@ example.com.       IN NS   ns.example.com.
 SECTION ADDITIONAL
 ns.example.com.                IN      A       1.2.3.4
 ENTRY_END
+
+ENTRY_BEGIN
+MATCH opcode qtype qname
+ADJUST copy_id
+REPLY QR NOERROR
+SECTION QUESTION
+8.7.6.5.in-addr.arpa. IN PTR
+SECTION ANSWER
+8.7.6.5.in-addr.arpa. PTR ip4.example.com.
+SECTION AUTHORITY
+7.6.5.in-addr.arpa. IN NS ns.example.com.
+ENTRY_END
+
 RANGE_END
 
 STEP 1 QUERY
@@ -208,4 +261,46 @@ SECTION ADDITIONAL
 ns.example.com.                IN      A       1.2.3.4
 ENTRY_END
 
+; test ptr lookup
+STEP 60 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+8.0.7.0.6.0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.9.f.f.4.6.0.0.ip6.arpa. IN PTR
+ENTRY_END
+
+; recursion happens here.
+STEP 70 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+8.0.7.0.6.0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.9.f.f.4.6.0.0.ip6.arpa. IN PTR
+SECTION ANSWER
+8.0.7.0.6.0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.9.f.f.4.6.0.0.ip6.arpa. IN PTR ip4.example.com.
+SECTION AUTHORITY
+7.6.5.in-addr.arpa. IN NS ns.example.com.
+ENTRY_END
+
+; synthesize from broken, malformed A records 
+STEP 80 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+broken.example.com. IN AAAA
+ENTRY_END
+
+; recursion happens here.
+STEP 90 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+broken.example.com. IN AAAA
+SECTION ANSWER
+SECTION AUTHORITY
+example.com.   IN SOA  a. b. 1 2 3 4 5
+SECTION ADDITIONAL
+ENTRY_END
+
 SCENARIO_END