BIND 10 trac2384, updated. 46f83b66089f84aea1bcee15cce153b498184966 [2384] Simplify range check
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Nov 8 17:25:20 UTC 2012
The branch, trac2384 has been updated
via 46f83b66089f84aea1bcee15cce153b498184966 (commit)
from 3f0397574f67e829a3d26732d08da246e945acb2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 46f83b66089f84aea1bcee15cce153b498184966
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Thu Nov 8 18:24:14 2012 +0100
[2384] Simplify range check
It doesn't need to check the number of digits. It seems the tests pass
now without problems as well. Also, it might be problematic with large
number of leading zeroes.
Also, simplify comment with description.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/rrttl.cc | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/rrttl.cc b/src/lib/dns/rrttl.cc
index b50b352..2352a30 100644
--- a/src/lib/dns/rrttl.cc
+++ b/src/lib/dns/rrttl.cc
@@ -98,14 +98,10 @@ RRTTL::RRTTL(const std::string& ttlstr) {
unit));
// Add what we found
val += multiply * value;
- // The partial value is still in range (the value can only grow,
- // so if we get out now, it won't get better).
- //
- // Any valid uint32_t number must have at most 10 digits. If it
- // has more, it could wrap around the int64_t silently (at least
- // in theory, some compilers seem to throw from lexical_cast).
- if (unit - pos > 10 || value < 0 || val < 0 ||
- val > 0xffffffff) {
+ // Check the partial value is still in range (the value can only
+ // grow, so if we get out of range now, it won't get better, so
+ // there's no need to continue).
+ if (value < 0 || val < 0 || val > 0xffffffff) {
isc_throw(InvalidRRTTL, "Part of TTL out of range: " <<
ttlstr);
}
More information about the bind10-changes
mailing list