diff --git a/dnscrypt-proxy/plugin_allow_name.go b/dnscrypt-proxy/plugin_allow_name.go index 005cbbc8..f0095d07 100644 --- a/dnscrypt-proxy/plugin_allow_name.go +++ b/dnscrypt-proxy/plugin_allow_name.go @@ -43,10 +43,14 @@ func (plugin *PluginAllowName) Init(proxy *Proxy) error { parts := strings.Split(line, "@") timeRangeName := "" if len(parts) == 2 { - line = strings.TrimSpace(parts[0]) - timeRangeName = strings.TrimSpace(parts[1]) + if timeRangeParts := strings.Split(parts[1], "@"); len(timeRangeParts) == 2 { + timeRangeName = strings.TrimSpace(timeRangeParts[1]) + } else { + dlog.Errorf("Syntax error in allowed names at line %d", 1+lineNo) + continue + } } else if len(parts) > 2 { - dlog.Errorf("Syntax error in allowed names at line %d -- Unexpected @ character", 1+lineNo) + dlog.Errorf("Syntax error in allowed names at line %d", 1+lineNo) continue } var weeklyRanges *WeeklyRanges diff --git a/dnscrypt-proxy/plugin_block_name.go b/dnscrypt-proxy/plugin_block_name.go index ae16be62..118406f2 100644 --- a/dnscrypt-proxy/plugin_block_name.go +++ b/dnscrypt-proxy/plugin_block_name.go @@ -97,13 +97,17 @@ func (plugin *PluginBlockName) Init(proxy *Proxy) error { if len(line) == 0 { continue } - parts := strings.Split(line, "@") + parts := strings.Fields(line) timeRangeName := "" if len(parts) == 2 { - line = strings.TrimSpace(parts[0]) - timeRangeName = strings.TrimSpace(parts[1]) + if timeRangeParts := strings.Split(parts[1], "@"); len(timeRangeParts) == 2 { + timeRangeName = strings.TrimSpace(timeRangeParts[1]) + } else { + dlog.Errorf("Syntax error in block rules at line %d", 1+lineNo) + continue + } } else if len(parts) > 2 { - dlog.Errorf("Syntax error in block rules at line %d -- Unexpected @ character", 1+lineNo) + dlog.Errorf("Syntax error in block rules at line %d", 1+lineNo) continue } var weeklyRanges *WeeklyRanges