summaryrefslogtreecommitdiffstats
path: root/usr.sbin/unbound/validator/val_utils.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2017-09-29 16:27:13 +0000
committersthen <sthen@openbsd.org>2017-09-29 16:27:13 +0000
commit7191de28ba0160ec5568a9c00fdeedd5e421f205 (patch)
tree379f19388a6a1ffbe64f91a1c85ce8aabedca0b6 /usr.sbin/unbound/validator/val_utils.c
parentRev. 1.2 enabled UTF-8 by default. (diff)
downloadwireguard-openbsd-7191de28ba0160ec5568a9c00fdeedd5e421f205.tar.xz
wireguard-openbsd-7191de28ba0160ec5568a9c00fdeedd5e421f205.zip
update to unbound-1.6.6, ok florian
Diffstat (limited to 'usr.sbin/unbound/validator/val_utils.c')
-rw-r--r--usr.sbin/unbound/validator/val_utils.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/unbound/validator/val_utils.c b/usr.sbin/unbound/validator/val_utils.c
index e4eff1b2523..973473f9dc8 100644
--- a/usr.sbin/unbound/validator/val_utils.c
+++ b/usr.sbin/unbound/validator/val_utils.c
@@ -932,17 +932,24 @@ val_check_nonsecure(struct module_env* env, struct reply_info* rep)
* Therefore the message is bogus.
*/
- /* check if authority consists of only an NS record
+ /* check if authority has an NS record
* which is bad, and there is an answer section with
* data. In that case, delete NS and additional to
* be lenient and make a minimal response */
- if(rep->an_numrrsets != 0 && rep->ns_numrrsets == 1 &&
+ if(rep->an_numrrsets != 0 &&
ntohs(rep->rrsets[i]->rk.type)
== LDNS_RR_TYPE_NS) {
verbose(VERB_ALGO, "truncate to minimal");
- rep->ns_numrrsets = 0;
rep->ar_numrrsets = 0;
- rep->rrset_count = rep->an_numrrsets;
+ rep->rrset_count = rep->an_numrrsets +
+ rep->ns_numrrsets;
+ /* remove this unneeded authority rrset */
+ memmove(rep->rrsets+i, rep->rrsets+i+1,
+ sizeof(struct ub_packed_rrset_key*)*
+ (rep->rrset_count - i - 1));
+ rep->ns_numrrsets--;
+ rep->rrset_count--;
+ i--;
return;
}