]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Make Coverity happy 11348/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 23 Feb 2022 09:00:30 +0000 (10:00 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 23 Feb 2022 09:00:30 +0000 (10:00 +0100)
- Test that a TCP response has a valid connection
- Remove a temporary when constructing the ring buffers

pdns/dnsdist-rings.hh
pdns/dnsdist-tcp.cc

index 86591add65776dd0bba15616ce7f10edf24413ff..f1b2f48709510ed2cb25bf6f6a8be172a4bd6b02 100644 (file)
@@ -65,8 +65,8 @@ struct Rings {
 
   struct Shard
   {
-    LockGuarded<boost::circular_buffer<Query>> queryRing{boost::circular_buffer<Query>()};
-    LockGuarded<boost::circular_buffer<Response>> respRing{boost::circular_buffer<Response>()};
+    LockGuarded<boost::circular_buffer<Query>> queryRing;
+    LockGuarded<boost::circular_buffer<Response>> 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)
index 2d5d024cb90ac6b8ae28208eca19a4003a6bd8ad..ada447c3de3fafe972877ef110bb2840ed424271 100644 (file)
@@ -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;
     }