0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-02-24 23:57:05 -05:00

admin: fix index validation for PUT requests (#6824)

This commit is contained in:
Mahdi Mohammadi 2025-02-04 19:27:32 +03:30 committed by GitHub
parent 9283770f68
commit 96c5c554c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1139,7 +1139,7 @@ traverseLoop:
return fmt.Errorf("[%s] invalid array index '%s': %v",
path, idxStr, err)
}
if idx < 0 || idx >= len(arr) {
if idx < 0 || (method != http.MethodPut && idx >= len(arr)) || idx > len(arr) {
return fmt.Errorf("[%s] array index out of bounds: %s", path, idxStr)
}
}