]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Avoid use of compound literals
authorPetr Špaček <pspacek@isc.org>
Thu, 3 Mar 2022 11:21:37 +0000 (12:21 +0100)
committerMichał Kępień <michal@isc.org>
Thu, 3 Mar 2022 12:33:00 +0000 (13:33 +0100)
Compound literals are not used in BIND 9.11, in order to ensure backward
compatibility with ancient compilers.  Rework the relevant parts of the
BIND 9.11 backport of the CVE-2021-25220 fix so that compound literals
are not used.

lib/dns/resolver.c

index 74c477e4018ec99e55c0ad0def52f8894a156199..8ae9a993bbd75c6383f0f1f5a24913085cc9e4fa 100644 (file)
@@ -6253,14 +6253,19 @@ name_external(dns_name_t *name, dns_rdatatype_t type, fetchctx_t *fctx) {
        dns_zone_t *zone = NULL;
        unsigned int labels;
        dns_namereln_t rel;
+       /*
+        * The following two variables do not influence code flow; they are
+        * only necessary for calling dns_name_fullcompare().
+        */
+       int _orderp = 0;
+       unsigned int _nlabelsp = 0;
 
        apex = ISFORWARDER(fctx->addrinfo) ? fctx->fwdname : &fctx->domain;
 
        /*
         * The name is outside the queried namespace.
         */
-       rel = dns_name_fullcompare(name, apex, &(int){ 0 },
-                                  &(unsigned int){ 0U });
+       rel = dns_name_fullcompare(name, apex, &_orderp, &_nlabelsp);
        if (rel != dns_namereln_subdomain && rel != dns_namereln_equal) {
                return (true);
        }
@@ -6292,8 +6297,8 @@ name_external(dns_name_t *name, dns_rdatatype_t type, fetchctx_t *fctx) {
                        dns_zone_detach(&zone);
                }
                if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
-                       if (dns_name_fullcompare(zfname, apex, &(int){ 0 },
-                                                &(unsigned int){ 0U }) ==
+                       if (dns_name_fullcompare(zfname, apex, &_orderp,
+                                                &_nlabelsp) ==
                            dns_namereln_subdomain)
                        {
                                UNLOCK(&fctx->res->view->lock);