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

Fixes #2119
This commit is contained in:
Harshavardhana authored and GitHub committed 2016-07-07 01:30:34 -07:00
1 parent 169c72cdab
commit ddf3245677
4 files changed
+18 -1

No files matched your search

+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 {