Commit c7208418 authored by Miek Gieben's avatar Miek Gieben Committed by GitHub

core: add nil check (#1005)

Check if msg is nil in DefaultErrorFunc. If this is the case log this
and short cut the function.

Hoping to get more insight in #925
parent 3974071f
......@@ -289,6 +289,12 @@ func DefaultErrorFunc(w dns.ResponseWriter, r *dns.Msg, rc int) {
answer := new(dns.Msg)
answer.SetRcode(r, rc)
if r == nil {
log.Printf("[WARNING] DefaultErrorFunc called with nil *dns.Msg (Remote: %s)", w.RemoteAddr().String())
w.WriteMsg(answer)
return
}
state.SizeAndDo(answer)
vars.Report(state, vars.Dropped, rcode.ToString(rc), answer.Len(), time.Now())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment