]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix the use of dns_wildcardname as an optimisation in DLZ
authorMark Andrews <marka@isc.org>
Mon, 18 Feb 2019 01:57:35 +0000 (12:57 +1100)
committerEvan Hunt <each@isc.org>
Fri, 8 Mar 2019 04:34:59 +0000 (20:34 -0800)
(cherry picked from commit cb32cd98bda3a7e57ad098eeda128c3a2ffcc95e)

lib/dns/sdlz.c

index 7c311329ef21b5ec6a6c197d74555d4ebe842ab9..9468101ae0e1750e7da5241a1f9f2ce37092b70d 100644 (file)
@@ -621,17 +621,20 @@ getnodedata(dns_db_t *db, dns_name_t *name, bool create,
                        dns_name_t *wild;
 
                        dns_fixedname_init(&fixed);
-                       if (i == dlabels)
+                       if (i == dlabels - 1) {
                                wild = dns_wildcardname;
-                       else {
-                               wild = dns_fixedname_name(&fixed);
+                       } else {
+                               dns_name_t *fname;
+                               fname = dns_fixedname_name(&fixed);
                                dns_name_getlabelsequence(name, i + 1,
                                                          dlabels - i - 1,
-                                                         wild);
+                                                         fname);
                                result = dns_name_concatenate(dns_wildcardname,
-                                                             wild, wild, NULL);
+                                                             fname, fname,
+                                                             NULL);
                                if (result != ISC_R_SUCCESS)
                                        return (result);
+                               wild = fname;
                        }
 
                        isc_buffer_init(&b, wildstr, sizeof(wildstr));