xl/fs: offset and length cannot be negative. (#2121)

Fixes #2119
This commit is contained in:
Harshavardhana
2016-07-07 01:30:34 -07:00
committed by GitHub
parent 169c72cdab
commit ddf3245677
4 changed files with 18 additions and 1 deletions
+4
View File
@@ -217,6 +217,10 @@ func (fs fsObjects) GetObject(bucket, object string, offset int64, length int64,
if !IsValidObjectName(object) {
return ObjectNameInvalid{Bucket: bucket, Object: object}
}
// Offset and length cannot be negative.
if offset < 0 || length < 0 {
return toObjectErr(errUnexpected, bucket, object)
}
var totalLeft = length
bufSize := int64(readSizeV1)
if length > 0 && bufSize > length {