Skip to content

Commit

Permalink
Fix issue #742 (#745)
Browse files Browse the repository at this point in the history
* Fix error comparison in SetTA

* Add testcase TestParseTA()
  • Loading branch information
tr3ee authored and miekg committed Sep 22, 2018
1 parent 833bf76 commit 501e858
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scan_rr.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,9 +1665,9 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
return nil, &ParseError{f, "bad TA DigestType", l}, ""
}
rr.DigestType = uint8(i)
s, e, c1 := endingToString(c, "bad TA Digest", f)
if e != nil {
return nil, e.(*ParseError), c1
s, err, c1 := endingToString(c, "bad TA Digest", f)
if err != nil {
return nil, err, c1
}
rr.Digest = s
return rr, nil, c1
Expand Down
10 changes: 10 additions & 0 deletions scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,13 @@ func TestParseZoneInclude(t *testing.T) {
}
}
}

func TestParseTA(t *testing.T) {
rr, err := NewRR(` Ta 0 0 0`)
if err != nil {
t.Fatalf("expected no error, but got %s", err)
}
if rr == nil {
t.Fatal(`expected a normal RR, but got nil`)
}
}

0 comments on commit 501e858

Please sign in to comment.