aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddyconfig/caddyfile/formatter.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2022-09-15 14:12:53 -0600
committerMatthew Holt <[email protected]>2022-09-15 14:12:53 -0600
commite6c58fdc085f8875361563551699bcf02e3ede8b (patch)
tree51993a5676c598eb6659251ca3eaacff53f600da /caddyconfig/caddyfile/formatter.go
parent2dc747cf2d7dd4e7337c1d7665042b896f3b4445 (diff)
downloadcaddy-e6c58fdc085f8875361563551699bcf02e3ede8b.tar.gz
caddy-e6c58fdc085f8875361563551699bcf02e3ede8b.zip
caddyfile: Prevent infinite nesting on fmt (fix #4175)
Diffstat (limited to 'caddyconfig/caddyfile/formatter.go')
-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 {