aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-26 03:23:06 -0800
committerchrislu <chris.lu@gmail.com>2022-02-26 03:23:06 -0800
commit3a58b7bac63349b938c76a6c07ca5275d92bb0bd (patch)
tree6f67ed98eae87855c230b33c4e6f792f26690f0c
parent708e14fcfa7182a08a8ed02c250d49de8eb3b5a6 (diff)
downloadseaweedfs-3a58b7bac63349b938c76a6c07ca5275d92bb0bd.tar.xz
seaweedfs-3a58b7bac63349b938c76a6c07ca5275d92bb0bd.zip
a little safer
-rw-r--r--weed/filer/filechunk_manifest.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/filer/filechunk_manifest.go b/weed/filer/filechunk_manifest.go
index 2c9dc5e74..372901b7d 100644
--- a/weed/filer/filechunk_manifest.go
+++ b/weed/filer/filechunk_manifest.go
@@ -124,8 +124,10 @@ func retriedFetchChunkData(buffer []byte, urlStrings []string, cipherKey []byte,
urlString = url.PathEscape(urlString)
}
shouldRetry, err = util.ReadUrlAsStream(urlString+"?readDeleted=true", cipherKey, isGzipped, isFullChunk, offset, len(buffer), func(data []byte) {
- x := copy(buffer[n:], data)
- n += x
+ if n < len(buffer) {
+ x := copy(buffer[n:], data)
+ n += x
+ }
})
if !shouldRetry {
break