diff --git a/parse_test.go b/parse_test.go index 6ea1932f..93129fa9 100644 --- a/parse_test.go +++ b/parse_test.go @@ -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) { diff --git a/scan_rr.go b/scan_rr.go index eee12cbb..3fe8a82a 100644 --- a/scan_rr.go +++ b/scan_rr.go @@ -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)