mirror of
https://github.com/restic/restic.git
synced 2025-10-10 12:00:56 +00:00
internal/repository: Fix LoadBlob + fuzz test
When given a buf that is big enough for a compressed blob but not its decompressed contents, the copy at the end of LoadBlob would skip the last part of the contents. Fixes #3783.
This commit is contained in:
@@ -303,8 +303,9 @@ func (r *Repository) LoadBlob(ctx context.Context, t restic.BlobType, id restic.
|
||||
return plaintext, nil
|
||||
}
|
||||
// move decrypted data to the start of the buffer
|
||||
buf = buf[:len(plaintext)]
|
||||
copy(buf, plaintext)
|
||||
return buf[:len(plaintext)], nil
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
if lastError != nil {
|
||||
|
Reference in New Issue
Block a user