mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Part ID check (#1730)
* Added check in PutObjectPartHandler to make sure part ID does not exceed 10000. ErrInvalidMaxParts written to response if part ID exceeds the maximum value.
This commit is contained in:
parent
584813e214
commit
b48b2e7f7c
@ -741,6 +741,12 @@ func (api objectAPIHandlers) PutObjectPartHandler(w http.ResponseWriter, r *http
|
||||
return
|
||||
}
|
||||
|
||||
// check partID with maximum part ID for multipart objects
|
||||
if isMaxPartID(partID) {
|
||||
writeErrorResponse(w, r, ErrInvalidMaxParts, r.URL.Path)
|
||||
return
|
||||
}
|
||||
|
||||
var partMD5 string
|
||||
switch getRequestAuthType(r) {
|
||||
default:
|
||||
|
7
utils.go
7
utils.go
@ -40,6 +40,8 @@ const (
|
||||
maxObjectSize = 1024 * 1024 * 1024 * 5
|
||||
// minimum Part size for multipart upload is 5MB
|
||||
minPartSize = 1024 * 1024 * 5
|
||||
// maximum Part ID for multipart upload is 10000 (Acceptable values range from 1 to 10000 inclusive)
|
||||
maxPartID = 10000
|
||||
)
|
||||
|
||||
// isMaxObjectSize - verify if max object size
|
||||
@ -52,6 +54,11 @@ func isMinAllowedPartSize(size int64) bool {
|
||||
return size >= minPartSize
|
||||
}
|
||||
|
||||
// isMaxPartNumber - Check if part ID is greater than the maximum allowed ID.
|
||||
func isMaxPartID(partID int) bool {
|
||||
return partID > maxPartID
|
||||
}
|
||||
|
||||
func contains(stringList []string, element string) bool {
|
||||
for _, e := range stringList {
|
||||
if e == element {
|
||||
|
Loading…
Reference in New Issue
Block a user