public:
DNSCryptQuery(const std::shared_ptr<DNSCryptContext>& ctx): d_ctx(ctx)
{
+ memset(&d_header, 0, sizeof(d_header));
+#ifdef HAVE_CRYPTO_BOX_EASY_AFTERNM
+ memset(&d_sharedKey, 0, sizeof(d_sharedKey));
+#endif /* HAVE_CRYPTO_BOX_EASY_AFTERNM */
}
+
~DNSCryptQuery();
bool isValid() const
struct DOHUnit* du{nullptr};
int delayMsec{0};
boost::optional<uint32_t> tempFailureTTL;
- uint32_t cacheKeyNoECS;
- uint32_t cacheKey;
+ uint32_t cacheKeyNoECS{0};
+ uint32_t cacheKey{0};
const uint16_t qtype;
const uint16_t qclass;
uint16_t ecsPrefixLength;
protected:
mutable StopWatch d_prev;
- mutable double d_tokens;
+ mutable double d_tokens{0.0};
};
class QPSLimiter : public BasicQPSLimiter
}
private:
- unsigned int d_rate;
- unsigned int d_burst;
+ unsigned int d_rate{0};
+ unsigned int d_burst{0};
bool d_passthrough{true};
};
std::shared_ptr<QTag> qTag{nullptr};
const ClientState* cs{nullptr};
DOHUnit* du{nullptr};
- uint32_t cacheKey; // 4
- uint32_t cacheKeyNoECS; // 4
- uint16_t age; // 4
- uint16_t qtype; // 2
- uint16_t qclass; // 2
- uint16_t origID; // 2
- uint16_t origFlags; // 2
+ uint32_t cacheKey{0}; // 4
+ uint32_t cacheKeyNoECS{0}; // 4
+ uint16_t age{0}; // 4
+ uint16_t qtype{0}; // 2
+ uint16_t qclass{0}; // 2
+ uint16_t origID{0}; // 2
+ uint16_t origFlags{0}; // 2
int origFD{-1};
int delayMsec{0};
boost::optional<uint32_t> tempFailureTTL;
std::string contentType;
std::atomic<uint64_t> d_refcnt{1};
size_t query_at{0};
- int rsock;
+ int rsock{-1};
/* the status_code is set from
processDOHQuery() (which is executed in
the DOH client thread) so that the correct
void init(){};
void merge(const SodiumNonce& lower, const SodiumNonce& higher) {};
void increment(){};
- unsigned char value[1];
+ unsigned char value[1]{0};
};
#else
#include <sodium.h>
struct SodiumNonce
{
+ SodiumNonce()
+ {
+ memset(&value, 0, sizeof(value));
+ }
+
void init()
{
randombytes_buf(value, sizeof value);
PacketBuffer plainQuery;
GenericDNSPacketWriter<PacketBuffer> pw(plainQuery, name, QType::AAAA, QClass::IN, 0);
pw.getHeader()->rd = 1;
- size_t requiredSize = plainQuery.size() + sizeof(DNSCryptQueryHeader) + DNSCRYPT_MAC_SIZE;
- if (requiredSize < DNSCryptQuery::s_minUDPLength) {
- requiredSize = DNSCryptQuery::s_minUDPLength;
- }
-
- plainQuery.resize(requiredSize);
size_t initialSize = plainQuery.size();
int res = ctx->encryptQuery(plainQuery, 4096, clientPublicKey, clientPrivateKey, clientNonce, false, std::make_shared<DNSCryptCert>(resolverCert));
GenericDNSPacketWriter<PacketBuffer> pw(plainQuery, name, QType::AAAA, QClass::IN, 0);
pw.getHeader()->rd = 1;
- size_t requiredSize = plainQuery.size() + sizeof(DNSCryptQueryHeader) + DNSCRYPT_MAC_SIZE;
- if (requiredSize < DNSCryptQuery::s_minUDPLength) {
- requiredSize = DNSCryptQuery::s_minUDPLength;
- }
-
size_t initialSize = plainQuery.size();
int res = ctx->encryptQuery(plainQuery, 4096, clientPublicKey, clientPrivateKey, clientNonce, false, std::make_shared<DNSCryptCert>(resolverCert));
*/
const ComboAddress lc("127.0.0.1");
const ComboAddress rem("127.0.0.1");
- size_t optContentStart;
- uint16_t optContentLen;
+ size_t optContentStart{std::numeric_limits<size_t>::max()};
+ uint16_t optContentLen{0};
const size_t optRDExpectedOffset = sizeof(dnsheader) + qname.wirelength() + DNS_TYPE_SIZE + DNS_CLASS_SIZE + /* root */ 1 + DNS_TYPE_SIZE + DNS_CLASS_SIZE + DNS_TTL_SIZE;