@marcel91200 / caddy Mirror · read-only / commits / e6c58fdc
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 13:00 UTC

caddyfile: Prevent infinite nesting on fmt (fix #4175)

Matthew Holt committed Sep 15, 2022 at 14:12 UTC e6c58fdc085f8875361563551699bcf02e3ede8b
1 file changed +4 -1
caddyconfig/caddyfile/formatter.go
+4 -1
@@ -153,7 +153,10 @@ func Format(input []byte) []byte {
153 openBraceWritten = true
154 nextLine()
155 newLines = 0
156 - nesting++
156 + // prevent infinite nesting from ridiculous inputs (issue #4175)
157 + if nesting < 10 {
158 + nesting++
159 + }
160 }
161
162 switch {