4028. [bug] $GENERATE with a zero step was not being caught as a

error.  A $GENERATE with a / but no step was not being
                        caught as a error. [RT #38262]
This commit is contained in:
Mark Andrews
2015-01-06 11:31:34 +11:00
parent 225908aece
commit b0c18fffd3
4 changed files with 52 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
4028. [bug] $GENERATE with a zero step was not being caught as a
error. A $GENERATE with a / but no step was not being
caught as a error. [RT #38262]
4027. [port] Net::DNS 0.81 compatibility. [RT #38165]
4026. [bug] Fix RFC 3658 reference in dig +sigchase. [RT #38173]

View File

@@ -0,0 +1,22 @@
; Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted, provided that the above
; copyright notice and this permission notice appear in all copies.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
;
; A trailing '/' is not permitted.
;
$GENERATE 1-3/ $ A 1.2.3.$

View File

@@ -0,0 +1,22 @@
; Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted, provided that the above
; copyright notice and this permission notice appear in all copies.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
$TTL 600
@ SOA ns hostmaster 2011012708 3600 1200 604800 1200
NS ns
ns A 192.0.2.1
;
; A step of zero is not permitted.
;
$GENERATE 1-3/0 $ A 1.2.3.$

View File

@@ -819,6 +819,7 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs,
isc_textregion_t r;
int i, n, start, stop, step = 0;
dns_incctx_t *ictx;
char dummy;
ictx = lctx->inc;
callbacks = lctx->callbacks;
@@ -835,9 +836,9 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs,
}
isc_buffer_init(&target, target_mem, target_size);
n = sscanf(range, "%d-%d/%d", &start, &stop, &step);
if ((n < 2) || (start < 0) || (stop < 0) || (step < 0) ||
(stop < start))
n = sscanf(range, "%d-%d%[/]%d", &start, &stop, &dummy, &step);
if ((n != 2 && n != 4) || (start < 0) || (stop < 0) ||
(n == 4 && step < 1) || (stop < start))
{
(*callbacks->error)(callbacks,
"%s: %s:%lu: invalid range '%s'",