Fix NSEC3PARAM SaltLength when parsing (#1088)
* fix parse nsec3param saltLength * division inside into cast
This commit is contained in:
parent
f0dca1ef05
commit
1d3a971542
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue