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

This commit is contained in:
Matthew Holt 2022-09-15 14:12:53 -06:00
parent 2dc747cf2d
commit e6c58fdc08
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -153,7 +153,10 @@ func Format(input []byte) []byte {
openBraceWritten = true openBraceWritten = true
nextLine() nextLine()
newLines = 0 newLines = 0
nesting++ // prevent infinite nesting from ridiculous inputs (issue #4175)
if nesting < 10 {
nesting++
}
} }
switch { switch {