summaryrefslogtreecommitdiff
path: root/validator/val_nsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'validator/val_nsec.c')
-rw-r--r--validator/val_nsec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/validator/val_nsec.c b/validator/val_nsec.c
index 4604f3d6d423..a795e77339d3 100644
--- a/validator/val_nsec.c
+++ b/validator/val_nsec.c
@@ -513,7 +513,6 @@ val_nsec_proves_no_wc(struct ub_packed_rrset_key* nsec, uint8_t* qname,
/* Determine if a NSEC record proves the non-existence of a
* wildcard that could have produced qname. */
int labs;
- int i;
uint8_t* ce = nsec_closest_encloser(qname, nsec);
uint8_t* strip;
size_t striplen;
@@ -526,13 +525,13 @@ val_nsec_proves_no_wc(struct ub_packed_rrset_key* nsec, uint8_t* qname,
* and next names. */
labs = dname_count_labels(qname) - dname_count_labels(ce);
- for(i=labs; i>0; i--) {
+ if(labs > 0) {
/* i is number of labels to strip off qname, prepend * wild */
strip = qname;
striplen = qnamelen;
- dname_remove_labels(&strip, &striplen, i);
+ dname_remove_labels(&strip, &striplen, labs);
if(striplen > LDNS_MAX_DOMAINLEN-2)
- continue; /* too long to prepend wildcard */
+ return 0; /* too long to prepend wildcard */
buf[0] = 1;
buf[1] = (uint8_t)'*';
memmove(buf+2, strip, striplen);