From 4d1d37a19dec71a127a4d38b6d64cd560e5ea36b Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Mon, 26 Nov 2001 23:51:21 +0000 Subject: [PATCH] out-of-range SOA timers were silently clamped [RT #2081] --- lib/dns/ttl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/dns/ttl.c b/lib/dns/ttl.c index cee74c3037..9cd2e7a5ba 100644 --- a/lib/dns/ttl.c +++ b/lib/dns/ttl.c @@ -15,11 +15,12 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ttl.c,v 1.22 2001/11/12 19:05:34 gson Exp $ */ +/* $Id: ttl.c,v 1.23 2001/11/26 23:51:21 gson Exp $ */ #include #include +#include #include #include @@ -154,15 +155,18 @@ bind_ttl(isc_textregion_t *source, isc_uint32_t *ttl) { * No legal counter / ttl is longer that 63 characters. */ if (source->length > sizeof(buf) - 1) - return(DNS_R_SYNTAX); + return (DNS_R_SYNTAX); strncpy(buf, source->base, source->length); buf[source->length] = '\0'; s = buf; do { + errno = 0; n = strtoul(s, &e, 10); if (s == e) return (DNS_R_SYNTAX); + if (n == UINT_MAX && errno == ERANGE) + return (DNS_R_SYNTAX); switch (*e) { case 'w': case 'W':