aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-12-11 14:32:51 +0000
committerGravatar GitHub <noreply@github.com> 2017-12-11 14:32:51 +0000
commit5a7e440476475b71ac3f98b666150ca5062c0e2a (patch)
treed768bc79248e1e083221d29e81b3be18c4d6e331 /plugin
parent27da0eba04ed527b7c978dd1b8549608706c7c89 (diff)
downloadcoredns-5a7e440476475b71ac3f98b666150ca5062c0e2a.tar.gz
coredns-5a7e440476475b71ac3f98b666150ca5062c0e2a.tar.zst
coredns-5a7e440476475b71ac3f98b666150ca5062c0e2a.zip
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.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/file/lookup.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugin/file/lookup.go b/plugin/file/lookup.go
index 4d4b19cd6..28594f300 100644
--- a/plugin/file/lookup.go
+++ b/plugin/file/lookup.go
@@ -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...)