fix: fail large content in DeleteMultipleObjects() early (#17321)

This commit is contained in:
jiuker 2023-06-01 01:58:14 +08:00 committed by GitHub
parent b8474295af
commit 14f6ac9222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -439,6 +439,11 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter,
// The max. XML contains 100000 object names (each at most 1024 bytes long) + XML overhead
const maxBodySize = 2 * 100000 * 1024
if r.ContentLength > maxBodySize {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrEntityTooLarge), r.URL)
return
}
// Unmarshal list of keys to be deleted.
deleteObjectsReq := &DeleteObjectsRequest{}
if err := xmlDecoder(r.Body, deleteObjectsReq, maxBodySize); err != nil {