Permalink
Browse files

auth: limit long version strings to 63 characters and catch exception…

…s in secpoll
  • Loading branch information...
1 parent 003aae5 commit a64fd6af8493db34d65656999f5c73ceaedee1fc @mind04 mind04 committed with mind04 Jan 13, 2015
Showing with 7 additions and 3 deletions.
  1. +4 −1 pdns/common_startup.cc
  2. +3 −2 pdns/secpoll-auth.cc
@@ -430,7 +430,10 @@ void mainthread()
DNSPacket::s_udpTruncationThreshold = std::max(512, ::arg().asNum("udp-truncation-threshold"));
DNSPacket::s_doEDNSSubnetProcessing = ::arg().mustDo("edns-subnet-processing");
- doSecPoll(true); // this must be BEFORE chroot
+ try {
+ doSecPoll(true); // this must be BEFORE chroot
+ }
+ catch(...) {}
if(!::arg()["chroot"].empty()) {
triggerLoadOfLibraries();
@@ -122,7 +122,8 @@ void doSecPoll(bool first)
struct timeval now;
gettimeofday(&now, 0);
- string query = "auth-" PACKAGEVERSION ".security-status."+::arg()["security-poll-suffix"];
+ string version = "auth-" + string(PACKAGEVERSION);
+ string query = version.substr(0, 63) +".security-status."+::arg()["security-poll-suffix"];
if(*query.rbegin()!='.')
query+='.';
@@ -149,7 +150,7 @@ void doSecPoll(bool first)
}
else {
- L<<Logger::Warning<<"Could not retrieve security status update for '" PACKAGEVERSION "' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
+ L<<Logger::Warning<<"Could not retrieve security status update for '"<<PACKAGEVERSION<<"' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
if(security_status == 1) // it was ok, not it is unknown
security_status = 0;
}

0 comments on commit a64fd6a

Please sign in to comment.