2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-27 07:16:40 +00:00

Extended plaintext buffer if necessary

This commit is contained in:
Alexander Neumann 2016-07-28 21:41:18 +02:00
parent 0e6c72ad1d
commit d609e4a986

View File

@ -49,6 +49,11 @@ func Repack(repo *Repository, packs, keepBlobs backend.IDSet) (err error) {
} }
ciphertext := buf[entry.Offset : entry.Offset+entry.Length] ciphertext := buf[entry.Offset : entry.Offset+entry.Length]
if cap(plaintext) < len(ciphertext) {
plaintext = make([]byte, len(ciphertext))
}
plaintext, err = crypto.Decrypt(repo.Key(), plaintext, ciphertext) plaintext, err = crypto.Decrypt(repo.Key(), plaintext, ciphertext)
if err != nil { if err != nil {
return err return err