Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 12, 03:15 UTC
admin: fix index validation for PUT requests (#6824)
Mahdi Mohammadi committed
Feb 4, 2025 at 19:27 UTC
96c5c554c1241430ac9ddea6f4b68948adcc961b
1 file changed
+1
-1
admin.go
+1
-1
@@ -1139,7 +1139,7 @@ traverseLoop:
1139
return fmt.Errorf("[%s] invalid array index '%s': %v",
1140
path, idxStr, err)
1141
}
1142
- if idx < 0 || idx >= len(arr) {
1142
+ if idx < 0 || (method != http.MethodPut && idx >= len(arr)) || idx > len(arr) {
1143
return fmt.Errorf("[%s] array index out of bounds: %s", path, idxStr)
1144
}
1145
}