Skip to content

Commit

Permalink
fix(comment test): Fail if NUL 0x00 char is found
Browse files Browse the repository at this point in the history
Oddly enough, the test passes when it shouldn't.

Partially resolves: pelletier#613
  • Loading branch information
jidicula committed Oct 5, 2021
1 parent 851d9c4 commit 6bc6702
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ func scanComment(b []byte) ([]byte, []byte, error) {
}
if b[i] == 0x0a {
return b[:i], b[i:], newDecodeError(b[:i], "comments cannot include the 0x0a LF character")
return b[:i], b[i:], newDecodeError(b[:i], "comments cannot include the 0x0A LF character")
}
if b[i] == 0x00 {
return b[:i], b[i:], newDecodeError(b[:i], "comments cannot include the 0x00 NUL character")
}
if b[i] == '\n' {
return b[:i], b[i:], nil
Expand Down

0 comments on commit 6bc6702

Please sign in to comment.