[svn] commit: r718 - /branches/parkinglot/src/lib/dns/cpp/rrttl.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Feb 4 09:54:32 UTC 2010
Author: jelte
Date: Thu Feb 4 09:54:32 2010
New Revision: 718
Log:
fix for negative TTL that gets parsed on newer versions of gcc/stdc++
Modified:
branches/parkinglot/src/lib/dns/cpp/rrttl.cc
Modified: branches/parkinglot/src/lib/dns/cpp/rrttl.cc
==============================================================================
--- branches/parkinglot/src/lib/dns/cpp/rrttl.cc (original)
+++ branches/parkinglot/src/lib/dns/cpp/rrttl.cc Thu Feb 4 09:54:32 2010
@@ -31,12 +31,15 @@
RRTTL::RRTTL(const string& ttlstr)
{
- uint32_t val;
+ // Some systems (at least gcc-4.4) flow negative values over into
+ // unsigned integer, where older systems failed to parse. We want
+ // that failure here, so we extract into int64 and check the value
+ uint64_t val;
istringstream iss(ttlstr);
iss >> dec >> val;
- if (iss.rdstate() == ios::eofbit) {
- ttlval_ = val;
+ if (iss.rdstate() == ios::eofbit && val >= 0 && val <= 0xffffffff) {
+ ttlval_ = static_cast<uint32_t>(val);
} else {
dns_throw(InvalidRRTTL, "invalid TTL");
}
More information about the bind10-changes
mailing list