mirror of
https://github.com/restic/restic.git
synced 2026-11-05 06:49:21 +00:00
repository: reject key and config files that are too short (#21977)
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This commit is contained in:
1 parent
d4088aa09b
commit
8baffc4027
4 files changed
+65
No files matched your search
@@ -98,6 +98,10 @@ func openKey(ctx context.Context, s *Repository, id restic.ID, password string)
|
||||
}
|
||||
|
||||
// decrypt master keys
|
||||
if len(k.Data) < crypto.CiphertextLength(0) {
|
||||
return nil, errors.New("invalid key file, data too short")
|
||||
}
|
||||
|
||||
nonce, ciphertext := k.Data[:k.user.NonceSize()], k.Data[k.user.NonceSize():]
|
||||
buf, err := k.user.Open(nil, nonce, ciphertext, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user