aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddyconfig/caddyfile/formatter.go
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2024-02-11 13:30:14 -0500
committerGitHub <[email protected]>2024-02-11 13:30:14 -0500
commite7a534d0a311d9fa75b5981879c755281c4c9fba (patch)
treee446468d2c0e9ae52a54a38869563a97fcc00adf /caddyconfig/caddyfile/formatter.go
parentc78ebb3d6ad796d8e2f67f46b9cda72b7472c2e4 (diff)
downloadcaddy-e7a534d0a311d9fa75b5981879c755281c4c9fba.tar.gz
caddy-e7a534d0a311d9fa75b5981879c755281c4c9fba.zip
caddyfile: Reject long heredoc markers (#6098)
Co-authored-by: Mohammed Al Sahaf <[email protected]>
Diffstat (limited to 'caddyconfig/caddyfile/formatter.go')
-rw-r--r--caddyconfig/caddyfile/formatter.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/caddyconfig/caddyfile/formatter.go b/caddyconfig/caddyfile/formatter.go
index 764f79118..423de542a 100644
--- a/caddyconfig/caddyfile/formatter.go
+++ b/caddyconfig/caddyfile/formatter.go
@@ -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
}