Skip to content

Commit

Permalink
Merge pull request #1479 from buildkite/keithduncan/fix-off-by-one
Browse files Browse the repository at this point in the history
Fix redactor table size
  • Loading branch information
keithduncan authored Aug 6, 2021
2 parents 8a5492d + 6f49c03 commit e6c4a51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bootstrap/redactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Redactor struct {
maxlen int

// Table of Boyer-Moore skip distances, and values to redact matching this end byte
table [255]struct {
table [256]struct {
skip int
needles [][]byte
}
Expand Down
8 changes: 8 additions & 0 deletions bootstrap/redactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,11 @@ func TestRedactorSubsetSecrets(t *testing.T) {
t.Errorf("Redaction failed: %s", buf.String())
}
}

func TestRedactorLatin1(t *testing.T) {
var buf bytes.Buffer
redactor := NewRedactor(&buf, "[REDACTED]", []string{"ÿ"})

redactor.Write([]byte("foo"))
redactor.Flush()
}

0 comments on commit e6c4a51

Please sign in to comment.