fix: fix index validation for PUT requests

This commit is contained in:
Mahdi Mohammadi 2025-02-03 18:36:16 +03:30
parent 9996d6a70b
commit e4e6fdcce0

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)
}
}