]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: fix coverity 1523746 and 1523745 13443/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 1 Nov 2023 15:07:11 +0000 (16:07 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 1 Nov 2023 15:07:11 +0000 (16:07 +0100)
Fixing a use_after_move and a copy_instead_of_move

pdns/recursordist/recursor_cache.cc
pdns/recursordist/syncres.cc

index b2e8fe1a7ebd7bae3f59e97d1d910a008aaaa898..95cfdc1658a2f5b4972289e8176b94f1ffe04cd3 100644 (file)
@@ -140,7 +140,7 @@ static void updateDNSSECValidationStateFromCache(boost::optional<vState>& state,
 }
 
 template <typename T>
-static void ptrAssign(T* ptr, T value)
+static void ptrAssign(T* ptr, const T& value)
 {
   if (ptr != nullptr) {
     *ptr = value;
index 8300e1c19eaed53b100e05fa2bfe1faa54ea1a93..7b5963e24c7c1fc0db7e2812b14df629ad10b1f2 100644 (file)
@@ -2327,7 +2327,7 @@ void SyncRes::getBestNSFromCache(const DNSName& qname, const QType qtype, vector
         auto insertionPair = beenthere.insert(std::move(answer));
         if (!insertionPair.second) {
           brokeloop = true;
-          LOG(prefix << qname << ": We have NS in cache for '" << subdomain << "' but part of LOOP (already seen " << answer.qname << ")! Trying less specific NS" << endl);
+          LOG(prefix << qname << ": We have NS in cache for '" << subdomain << "' but part of LOOP (already seen " << insertionPair.first->qname << ")! Trying less specific NS" << endl);
           ;
           if (doLog())
             for (set<GetBestNSAnswer>::const_iterator j = beenthere.begin(); j != beenthere.end(); ++j) {