]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix minor issues reported by Coverity
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 15 May 2019 09:04:23 +0000 (11:04 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 15 May 2019 09:04:23 +0000 (11:04 +0200)
One useless test due to the condition being always true,
and one uncatched exception if we ever try to get the handle of a
non-established TCP connection which should never happen.

pdns/dnsdist-tcp.cc
pdns/dnsdist.cc

index 1c51cdc16cab584b5df2f00c31c1262a877c61d0..3a3ecbdd2e93bb7885b5a79c2a0207b78ae5340a 100644 (file)
@@ -440,6 +440,10 @@ public:
         catch(const FDMultiplexerException& e) {
           vinfolog("Got an exception when trying to remove a pending IO operation on the socket to the %s backend: %s", d_ds->getName(), e.what());
         }
+        catch(const std::runtime_error& e) {
+          /* might be thrown by getHandle() */
+          vinfolog("Got an exception when trying to remove a pending IO operation on the socket to the %s backend: %s", d_ds->getName(), e.what());
+        }
       }
     }
 
index deea14b769773f257d3de6990addd65c2d4c1e97..95b1d7f8f2689efce3add9eacb41d6b370225935 100644 (file)
@@ -1668,7 +1668,7 @@ static void MultipleMessagesUDPClientThread(ClientState* cs, LocalHolders& holde
       unsigned int got = msgVec[msgIdx].msg_len;
       const ComboAddress& remote = recvData[msgIdx].remote;
 
-      if (got < 0 || static_cast<size_t>(got) < sizeof(struct dnsheader)) {
+      if (static_cast<size_t>(got) < sizeof(struct dnsheader)) {
         ++g_stats.nonCompliantQueries;
         continue;
       }