Fix NSEC3PARAM SaltLength when parsing (#1088)

* fix parse nsec3param saltLength

* division inside into cast
This commit is contained in:
Manabu Sonoda 2020-03-11 18:24:25 +09:00 committed by GitHub
parent f0dca1ef05
commit 1d3a971542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -358,6 +358,17 @@ func TestNSEC(t *testing.T) {
t.Errorf("`%s' should be equal to\n`%s', but is `%s'", i, o, rr.String())
}
}
rr, err := NewRR("nl. IN NSEC3PARAM 1 0 5 30923C44C6CBBB8F")
if err != nil {
t.Fatal("failed to parse RR: ", err)
}
if nsec3param, ok := rr.(*NSEC3PARAM); ok {
if nsec3param.SaltLength != 8 {
t.Fatalf("nsec3param saltlen %d != 8", nsec3param.SaltLength)
}
} else {
t.Fatal("not nsec3 param: ", err)
}
}
func TestParseLOC(t *testing.T) {

View File

@ -1063,7 +1063,7 @@ func (rr *NSEC3PARAM) parse(c *zlexer, o string) *ParseError {
c.Next()
l, _ = c.Next()
if l.token != "-" {
rr.SaltLength = uint8(len(l.token))
rr.SaltLength = uint8(len(l.token) / 2)
rr.Salt = l.token
}
return slurpRemainder(c)