Mostly they are due to DNS using 32-bit timestamps.
int n=0;
int numread;
while(n<bytes) {
- int res=waitForData(d_sock, timeoutsec-(time(nullptr)-start));
+ // coverity[store_truncates_time_t]
+ int res=waitForData(d_sock, timeoutsec - (time(nullptr) - start));
if(res<0)
throw ResolverException("Reading data from remote nameserver over TCP: "+stringerror());
if(!res)
s.connect(primary, xfrTimeout);
time_t elapsed = timeoutChecker();
+ // coverity[store_truncates_time_t]
s.writenWithTimeout(msg.data(), msg.size(), xfrTimeout - elapsed);
// CURRENT PRIMARY SOA
addToRRSet(now, wcSet, wcSignatures, name, doDNSSEC, ret, DNSResourceRecord::ANSWER);
/* no need for closest encloser proof, the wildcard is there */
+ // coverity[store_truncates_time_t]
addRecordToRRSet(nextCloser.d_owner, QType::NSEC3, nextCloser.d_ttd - now, nextCloser.d_record, nextCloser.d_signatures, doDNSSEC, ret);
/* and of course we won't deny the wildcard either */
}
addToRRSet(now, wcSet, wcSignatures, name, doDNSSEC, ret, DNSResourceRecord::ANSWER);
+ // coverity[store_truncates_time_t]
addRecordToRRSet(nsec.d_owner, QType::NSEC, nsec.d_ttd - now, nsec.d_record, nsec.d_signatures, doDNSSEC, ret);
VLOG(log, name << ": Synthesized valid answer from NSECs and wildcard!" << endl);
addRecordToRRSet(nextCloserEntry.d_owner, QType::NSEC3, nextCloserEntry.d_ttd - now, nextCloserEntry.d_record, nextCloserEntry.d_signatures, doDNSSEC, ret);
}
if (wcEntry.d_owner != closestNSEC3.d_owner && wcEntry.d_owner != nextCloserEntry.d_owner) {
+ // coverity[store_truncates_time_t]
addRecordToRRSet(wcEntry.d_owner, QType::NSEC3, wcEntry.d_ttd - now, wcEntry.d_record, wcEntry.d_signatures, doDNSSEC, ret);
}
addRecordToRRSet(entry.d_owner, QType::NSEC, entry.d_ttd - now, entry.d_record, entry.d_signatures, doDNSSEC, ret);
if (needWildcard) {
+ // coverity[store_truncates_time_t]
addRecordToRRSet(wcEntry.d_owner, QType::NSEC, wcEntry.d_ttd - now, wcEntry.d_record, wcEntry.d_signatures, doDNSSEC, ret);
}
time_t axfrStart = time(nullptr);
time_t axfrNow = time(nullptr);
+ // coverity[store_truncates_time_t]
while (axfr.getChunk(nop, &chunk, (axfrStart + axfrTimeout - axfrNow)) != 0) {
for (auto& dnsRecord : chunk) {
if (config.d_zonemd != pdns::ZoneMD::Config::Ignore) {
if (elapsed >= timeout) {
throw PDNSException("Timeout waiting for control channel data");
}
+ // coverity[store_truncates_time_t]
int ret = waitForData(fd, timeout - elapsed, 0);
if (ret == 0) {
throw PDNSException("Timeout waiting for control channel data");
}
if (now < iter->d_ttd) { // it is right, it is fresh!
+ // coverity[store_truncates_time_t]
*age = static_cast<uint32_t>(now - iter->d_creation);
// we know ttl is > 0
auto ttl = static_cast<uint32_t>(iter->d_ttd - now);
prior to calling this function, so the TTL actually holds a TTD. */
cacheEntry.d_ttd = min(maxTTD, static_cast<time_t>(record.d_ttl)); // XXX this does weird things if TTLs differ in the set
+ // coverity[store_truncates_time_t]
cacheEntry.d_orig_ttl = cacheEntry.d_ttd - ttl_time;
// Even though we record the time the ttd was computed, there still seems to be a case where the computed
// d_orig_ttl can wrap.
return false; // would be dead anyhow
}
+ // coverity[store_truncates_time_t]
auto maxTTL = static_cast<uint32_t>(cacheEntry.d_ttd - now);
if (maxTTL > newTTL) {
lockedShard->d_cachecachevalid = false;
arr.d_type = QType::A;
aaaarr.d_type = QType::AAAA;
nsrr.d_type = QType::NS;
+ // coverity[store_truncates_time_t]
arr.d_ttl = aaaarr.d_ttl = nsrr.d_ttl = now + 3600000;
string templ = "a.root-servers.net.";
time_t axfrStart = time(nullptr);
time_t axfrNow = time(nullptr);
shared_ptr<const SOARecordContent> sr;
+ // coverity[store_truncates_time_t]
while (axfr.getChunk(nop, &chunk, (axfrStart + axfrTimeout - axfrNow))) {
for (auto& dr : chunk) {
if (dr.d_type == QType::NS || dr.d_type == QType::TSIG) {
{
uint32_t res = 0;
if (now < rrsig->d_sigexpire) {
+ // coverity[store_truncates_time_t]
res = static_cast<uint32_t>(rrsig->d_sigexpire) - now;
}
return res;
/* day is now the number of days since 'Jan 1 1970' */
i = 7;
+ // coverity[store_truncates_time_t]
t->tm_wday = (day + 4) % i; /* Sunday=0, Monday=1, ..., Saturday=6 */
i = 24;