From f6a8107761b40efcf7512e9aec9a75d1ba1de703 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 16 Feb 2017 13:59:54 +0100 Subject: [PATCH] Fix coverity nits --- modules/gpgsqlbackend/spgsql.cc | 6 +++++- pdns/dbdnsseckeeper.cc | 4 +--- pdns/dnsdist-tcp.cc | 6 ++++-- pdns/dnspacket.cc | 2 ++ pdns/rfc2136handler.cc | 11 +++++------ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index 724c4e705..2b4004039 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -32,7 +32,6 @@ #include "pdns/namespaces.hh" #include - class SPgSQLStatement: public SSqlStatement { public: @@ -47,6 +46,11 @@ public: paramValues = NULL; paramLengths = NULL; d_do_commit = false; + d_paridx = 0; + d_residx = 0; + d_resnum = 0; + d_fnum = 0; + d_cur_set = 0; } SSqlStatement* bind(const string& name, bool value) { return bind(name, string(value ? "t" : "f")); } diff --git a/pdns/dbdnsseckeeper.cc b/pdns/dbdnsseckeeper.cc index ea9b6ff06..d3bfff373 100644 --- a/pdns/dbdnsseckeeper.cc +++ b/pdns/dbdnsseckeeper.cc @@ -261,9 +261,7 @@ bool DNSSECKeeper::getNSEC3PARAM(const DNSName& zname, NSEC3PARAMRecordContent* static int maxNSEC3Iterations=::arg().asNum("max-nsec3-iterations"); if(ns3p) { - NSEC3PARAMRecordContent* tmp=dynamic_cast(DNSRecordContent::mastermake(QType::NSEC3PARAM, 1, value)); - *ns3p = *tmp; - delete tmp; + *ns3p = NSEC3PARAMRecordContent(value); if (ns3p->d_iterations > maxNSEC3Iterations) { ns3p->d_iterations = maxNSEC3Iterations; L<= 0) { + close(ci.fd); + } + ci.fd = -1; if (ds && outstanding) { outstanding = false; --ds->outstanding; diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index 64619d721..32e5af1bb 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -128,6 +128,8 @@ DNSPacket::DNSPacket(const DNSPacket &orig) d_rawpacket=orig.d_rawpacket; d_tsig_algo=orig.d_tsig_algo; d=orig.d; + + d_isQuery = orig.d_isQuery; } void DNSPacket::setRcode(int v) diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index 587a108a5..4b20dd8b5 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -657,10 +657,10 @@ int PacketHandler::forwardPacket(const string &msgPrefix, DNSPacket *p, DomainIn continue; } - char lenBuf[2]; - int recvRes; + unsigned char lenBuf[2]; + ssize_t recvRes; recvRes = recv(sock, &lenBuf, sizeof(lenBuf), 0); - if (recvRes < 0) { + if (recvRes < 0 || static_cast(recvRes) < sizeof(lenBuf)) { L<(recvRes)); L<