From 33d01bbdc7a5dfa934223c0cadae72988a5de8bd Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 15 May 2019 11:04:23 +0200 Subject: [PATCH] dnsdist: Fix minor issues reported by Coverity 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 | 4 ++++ pdns/dnsdist.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 1c51cdc16..3a3ecbdd2 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -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()); + } } } diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index deea14b76..95b1d7f8f 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -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(got) < sizeof(struct dnsheader)) { + if (static_cast(got) < sizeof(struct dnsheader)) { ++g_stats.nonCompliantQueries; continue; } -- 2.49.0