aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--caddyconfig/caddyfile/formatter.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/caddyconfig/caddyfile/formatter.go b/caddyconfig/caddyfile/formatter.go
index cb0033f76..3981cd699 100644
--- a/caddyconfig/caddyfile/formatter.go
+++ b/caddyconfig/caddyfile/formatter.go
@@ -153,7 +153,10 @@ func Format(input []byte) []byte {
openBraceWritten = true
nextLine()
newLines = 0
- nesting++
+ // prevent infinite nesting from ridiculous inputs (issue #4175)
+ if nesting < 10 {
+ nesting++
+ }
}
switch {