caddyfile: Reject long heredoc markers (#6098)

Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
Francis Lavoie 2024-02-11 13:30:14 -05:00 committed by GitHub
parent c78ebb3d6a
commit e7a534d0a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 10 deletions

View file

@ -149,6 +149,10 @@ func (l *lexer) next() (bool, error) {
continue
}
if len(val) > 32 {
return false, fmt.Errorf("heredoc marker too long on line #%d: %s", l.line, string(val))
}
// after hitting a newline, we know that the heredoc marker
// is the characters after the two << and the newline.
// we reset the val because the heredoc is syntax we don't