summaryrefslogtreecommitdiff
path: root/caddyconfig
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-09-15 14:12:53 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-09-15 14:12:53 -0600
commite6c58fdc085f8875361563551699bcf02e3ede8b (patch)
tree51993a5676c598eb6659251ca3eaacff53f600da /caddyconfig
parent2dc747cf2d7dd4e7337c1d7665042b896f3b4445 (diff)
caddyfile: Prevent infinite nesting on fmt (fix #4175)
Diffstat (limited to 'caddyconfig')
-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 cb0033f..3981cd6 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 {