1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-09 00:00:02 +01:00

Correct length of plaintext before decryption

This commit is contained in:
Alexander Neumann 2015-02-18 20:44:21 +01:00
parent 2462f93533
commit 68141c738b

2
key.go
View file

@ -498,8 +498,8 @@ func (k *Key) decrypt(ks *keys, plaintext, ciphertext []byte) ([]byte, error) {
// decrypt
e := cipher.NewCTR(c, iv)
e.XORKeyStream(plaintext, ciphertext)
plaintext = plaintext[:len(ciphertext)]
e.XORKeyStream(plaintext, ciphertext)
return plaintext, nil
}