plugin/file: fix crash (#1301)

When z.Tree.Prev returns zero we should break out of this loop, not
use elem as if nothing has happened.

Can be triggered by sending edns0 to unsigned zone.
This commit is contained in:
Miek Gieben
2017-12-11 14:32:51 +00:00
committed by GitHub
parent 27da0eba04
commit 5a7e440476
2 changed files with 106 additions and 1 deletions

View File

@@ -235,7 +235,10 @@ func (z *Zone) Lookup(state request.Request, qname string) ([]dns.RR, []dns.RR,
ret := z.soa(do)
if do {
deny, _ := z.Tree.Prev(qname) // TODO(miek): *found* was not used here.
deny, found := z.Tree.Prev(qname)
if !found {
goto Out
}
nsec := z.typeFromElem(deny, dns.TypeNSEC, do)
ret = append(ret, nsec...)