2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

out-of-range SOA timers were silently clamped [RT #2081]

This commit is contained in:
Andreas Gustafsson
2001-11-26 23:51:21 +00:00
parent 751af0ee2f
commit 4d1d37a19d

View File

@@ -15,11 +15,12 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * 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 <config.h> #include <config.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -154,15 +155,18 @@ bind_ttl(isc_textregion_t *source, isc_uint32_t *ttl) {
* No legal counter / ttl is longer that 63 characters. * No legal counter / ttl is longer that 63 characters.
*/ */
if (source->length > sizeof(buf) - 1) if (source->length > sizeof(buf) - 1)
return(DNS_R_SYNTAX); return (DNS_R_SYNTAX);
strncpy(buf, source->base, source->length); strncpy(buf, source->base, source->length);
buf[source->length] = '\0'; buf[source->length] = '\0';
s = buf; s = buf;
do { do {
errno = 0;
n = strtoul(s, &e, 10); n = strtoul(s, &e, 10);
if (s == e) if (s == e)
return (DNS_R_SYNTAX); return (DNS_R_SYNTAX);
if (n == UINT_MAX && errno == ERANGE)
return (DNS_R_SYNTAX);
switch (*e) { switch (*e) {
case 'w': case 'w':
case 'W': case 'W':