From e571b6a6567a1a5fdc24741621f27b68d2f49103 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 13 Jan 2017 21:23:47 +0100 Subject: [PATCH] Use the same buffer for decryption --- src/restic/repository/repository.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/restic/repository/repository.go b/src/restic/repository/repository.go index c71c75e41..948301cc5 100644 --- a/src/restic/repository/repository.go +++ b/src/restic/repository/repository.go @@ -64,15 +64,13 @@ func (r *Repository) LoadAndDecrypt(t restic.FileType, id restic.ID) ([]byte, er return nil, errors.New("invalid data returned") } - plain := make([]byte, len(buf)) - // decrypt - n, err := r.decryptTo(plain, buf) + n, err := r.decryptTo(buf, buf) if err != nil { return nil, err } - return plain[:n], nil + return buf[:n], nil } // loadBlob tries to load and decrypt content identified by t and id from a