diff --git a/pdns/recursordist/lwres.hh b/pdns/recursordist/lwres.hh index 58d43535e32c..3b2bc43a1d02 100644 --- a/pdns/recursordist/lwres.hh +++ b/pdns/recursordist/lwres.hh @@ -79,10 +79,10 @@ public: } vector d_records; + uint32_t d_usec{0}; int d_rcode{0}; bool d_validpacket{false}; bool d_aabit{false}, d_tcbit{false}; - uint32_t d_usec{0}; bool d_haveEDNS{false}; }; diff --git a/pdns/recursordist/rec-tcounters.hh b/pdns/recursordist/rec-tcounters.hh index 80f7e41353d2..feeba0d6ab4e 100644 --- a/pdns/recursordist/rec-tcounters.hh +++ b/pdns/recursordist/rec-tcounters.hh @@ -195,8 +195,8 @@ struct Counters } return *this; } - static const size_t numberoOfRCodes = 16; - std::array rcodeCounters; + static const size_t numberOfRCodes = 16; + std::array rcodeCounters; }; // An RCodes histogram RCodeCounters auth{}; diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 3e4f5a941d65..53ff27f98f22 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -5552,7 +5552,9 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname, } accountAuthLatency(lwr.d_usec, remoteIP.sin4.sin_family); - ++t_Counters.at(rec::RCode::auth).rcodeCounters.at(static_cast(lwr.d_rcode)); + if (lwr.d_rcode >= 0 && lwr.d_rcode < static_cast(t_Counters.at(rec::RCode::auth).rcodeCounters.size())) { + ++t_Counters.at(rec::RCode::auth).rcodeCounters.at(static_cast(lwr.d_rcode)); + } if (!dontThrottle) { dontThrottle = shouldNotThrottle(&nsName, &remoteIP);