diff --git a/zscan.go b/zscan.go index fc4e1d09..903b806b 100644 --- a/zscan.go +++ b/zscan.go @@ -252,6 +252,10 @@ func parseZone(r io.Reader, origin, f string, t chan Token, include int) { case _BLANK: l := <-c if l.value == _STRING { + if _, _, ok := IsDomainName(l.token); !ok { + t <- Token{Error: &ParseError{f, "bad origin name", l}} + return + } // a new origin is specified. if !IsFqdn(l.token) { if origin != "." { // Prevent .. endings @@ -317,6 +321,10 @@ func parseZone(r io.Reader, origin, f string, t chan Token, include int) { if e := slurpRemainder(c, f); e != nil { t <- Token{Error: e} } + if _, _, ok := IsDomainName(l.token); !ok { + t <- Token{Error: &ParseError{f, "bad origin name", l}} + return + } if !IsFqdn(l.token) { if origin != "." { // Prevent .. endings origin = l.token + "." + origin