mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Fix obsure crash in Corefile parsing (#4637)
This was found by fuzzing. We need to make this a fully qualified domain name to catch all errors in dnsserver/register.go and not later when plugin.Normalize() is called again on these strings, with the prime difference being that the domain name is fully qualified. This was found by fuzzing where "ȶ" is deemed OK, but "ȶ." is not (might be a bug in miekg/dns actually). But here we were checking ȶ, which is OK, and later we barf in ȶ. leading to "index out of range". Added a tests and check manually if it would crash with the current code (yes), and fail with an error in this PR (yes). Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -132,7 +132,11 @@ func OriginsFromArgsOrServerBlock(args, serverblock []string) []string {
|
||||
}
|
||||
s := []string{}
|
||||
for i := range args {
|
||||
s = append(s, Host(args[i]).Normalize()...)
|
||||
sx := Host(args[i]).Normalize()
|
||||
if len(sx) == 0 {
|
||||
continue // silently ignores errors.
|
||||
}
|
||||
s = append(s, sx...)
|
||||
}
|
||||
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user