mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
caddyfile: Reject long heredoc markers (#6098)
Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
parent
c78ebb3d6a
commit
e7a534d0a3
4 changed files with 40 additions and 10 deletions
|
|
@ -16,6 +16,7 @@ package caddyfile
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"unicode"
|
||||
|
||||
|
|
@ -118,6 +119,10 @@ func Format(input []byte) []byte {
|
|||
heredoc = heredocClosed
|
||||
} else {
|
||||
heredocMarker = append(heredocMarker, ch)
|
||||
if len(heredocMarker) > 32 {
|
||||
errorString := fmt.Sprintf("heredoc marker too long: <<%s", string(heredocMarker))
|
||||
panic(errorString)
|
||||
}
|
||||
write(ch)
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue