]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3704. [protocol] Accept integer timestamps in RRSIG records. [RT #35185]
authorMark Andrews <marka@isc.org>
Tue, 14 Jan 2014 05:06:45 +0000 (16:06 +1100)
committerMark Andrews <marka@isc.org>
Tue, 14 Jan 2014 05:08:16 +0000 (16:08 +1100)
CHANGES
lib/dns/rdata/generic/rrsig_46.c

diff --git a/CHANGES b/CHANGES
index d466baae13729d26a6cdf73ac01d543b53ee0436..f4aed8e5c1e01a7fb8484cf9b0915b4936748a8f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3704.  [protocol]      Accept integer timestamps in RRSIG records. [RT #35185]
+
        --- 9.6-ESV-R11rc1 released ---
 
 3698.  [cleanup]       Replaced all uses of memcpy() with memmove().
index 5b761d85fee9c224b85ce1f9b9b288c0aff1ce1e..b450fed77f76548acabbfa496cedd0b4f186c5b0 100644 (file)
@@ -90,7 +90,19 @@ fromtext_rrsig(ARGS_FROMTEXT) {
         */
        RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
                                      ISC_FALSE));
-       RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_expire));
+       if (strlen(DNS_AS_STR(token)) <= 10U &&
+           *DNS_AS_STR(token) != '-' && *DNS_AS_STR(token) != '+') {
+               char *end;
+               unsigned long l;
+
+               l = strtoul(DNS_AS_STR(token), &end, 10);
+               if (l == ULONG_MAX || *end != 0)
+                       RETTOK(DNS_R_SYNTAX);
+               if ((isc_uint64_t)l > (isc_uint64_t)0xffffffff)
+                       RETTOK(ISC_R_RANGE);
+               time_expire = l;
+       } else
+                RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_expire));
        RETERR(uint32_tobuffer(time_expire, target));
 
        /*
@@ -98,7 +110,19 @@ fromtext_rrsig(ARGS_FROMTEXT) {
         */
        RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
                                      ISC_FALSE));
-       RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_signed));
+       if (strlen(DNS_AS_STR(token)) <= 10U &&
+           *DNS_AS_STR(token) != '-' && *DNS_AS_STR(token) != '+') {
+               char *end;
+               unsigned long l;
+
+               l = strtoul(DNS_AS_STR(token), &end, 10);
+               if (l == ULONG_MAX || *end != 0)
+                       RETTOK(DNS_R_SYNTAX);
+               if ((isc_uint64_t)l > (isc_uint64_t)0xffffffff)
+                       RETTOK(ISC_R_RANGE);
+               time_signed = l;
+       } else
+               RETTOK(dns_time32_fromtext(DNS_AS_STR(token), &time_signed));
        RETERR(uint32_tobuffer(time_signed, target));
 
        /*