Add missing checks if $ORIGIN's name is valid
Call IsDomainName() as $ORIGIN is rel. infrequent this does not impact the parsing speed.
This commit is contained in:
parent
d594c79d19
commit
623de14ebb
8
zscan.go
8
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
|
||||
|
|
Loading…
Reference in New Issue