From: Remi Gacogne Date: Wed, 23 Feb 2022 09:00:30 +0000 (+0100) Subject: dnsdist: Make Coverity happy X-Git-Tag: rec-4.7.0-alpha1~4^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7f94a432a852dbb32e7a040b24da23dc0b17f6d;p=thirdparty%2Fpdns.git dnsdist: Make Coverity happy - Test that a TCP response has a valid connection - Remove a temporary when constructing the ring buffers --- diff --git a/pdns/dnsdist-rings.hh b/pdns/dnsdist-rings.hh index 86591add65..f1b2f48709 100644 --- a/pdns/dnsdist-rings.hh +++ b/pdns/dnsdist-rings.hh @@ -65,8 +65,8 @@ struct Rings { struct Shard { - LockGuarded> queryRing{boost::circular_buffer()}; - LockGuarded> respRing{boost::circular_buffer()}; + LockGuarded> queryRing; + LockGuarded> respRing; }; Rings(size_t capacity=10000, size_t numberOfShards=10, size_t nbLockTries=5, bool keepLockingStats=false): d_blockingQueryInserts(0), d_blockingResponseInserts(0), d_deferredQueryInserts(0), d_deferredResponseInserts(0), d_nbQueryEntries(0), d_nbResponseEntries(0), d_currentShardId(0), d_capacity(capacity), d_numberOfShards(numberOfShards), d_nbLockTries(nbLockTries), d_keepLockingStats(keepLockingStats) diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 2d5d024cb9..ada447c3de 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -521,7 +521,7 @@ void IncomingTCPConnectionState::handleResponse(const struct timeval& now, TCPRe try { auto& ids = response.d_idstate; unsigned int qnameWireLength; - if (!responseContentMatches(response.d_buffer, ids.qname, ids.qtype, ids.qclass, response.d_connection->getRemote(), qnameWireLength)) { + if (!response.d_connection || !responseContentMatches(response.d_buffer, ids.qname, ids.qtype, ids.qclass, response.d_connection->getRemote(), qnameWireLength)) { state->terminateClientConnection(); return; }