]> granicus.if.org Git - pdns/commitdiff
Check NSEC3PARAMRecordContent pointer before dereferencing it.
authorRemi Gacogne <rgacogne-github@coredump.fr>
Tue, 3 Nov 2015 15:14:06 +0000 (16:14 +0100)
committerRemi Gacogne <rgacogne-github@coredump.fr>
Tue, 3 Nov 2015 15:14:06 +0000 (16:14 +0100)
Bind2Backend::getNSEC3PARAM() does not seem to be called with a NULL
NSEC3PARAMRecordContent pointer, but better safe than sorry.

modules/bindbackend/binddnssec.cc

index 30bc7f8cd8aa93af7dc428d01009ea2551000bf0..4066e39db2853e47b64ea55134605be795ae267f 100644 (file)
@@ -167,11 +167,13 @@ bool Bind2Backend::getNSEC3PARAM(const DNSName& name, NSEC3PARAMRecordContent* n
     NSEC3PARAMRecordContent* tmp=dynamic_cast<NSEC3PARAMRecordContent*>(DNSRecordContent::mastermake(QType::NSEC3PARAM, 1, value));
     *ns3p = *tmp;
     delete tmp;
+
+    if (ns3p->d_iterations > maxNSEC3Iterations) {
+      ns3p->d_iterations = maxNSEC3Iterations;
+      L<<Logger::Error<<"Number of NSEC3 iterations for zone '"<<name.toString()<<"' is above 'max-nsec3-iterations'. Value adjsted to: "<<maxNSEC3Iterations<<endl;
+    }
   }
-  if (ns3p->d_iterations > maxNSEC3Iterations) {
-    ns3p->d_iterations = maxNSEC3Iterations;
-    L<<Logger::Error<<"Number of NSEC3 iterations for zone '"<<name.toString()<<"' is above 'max-nsec3-iterations'. Value adjsted to: "<<maxNSEC3Iterations<<endl;
-  }
+
   return true;
 }