mirror of
https://github.com/restic/restic.git
synced 2026-10-24 17:58:53 +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
@@ -198,6 +198,10 @@ func (r *Repository) LoadUnpacked(ctx context.Context, t restic.FileType, id res
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(buf) < crypto.CiphertextLength(0) {
|
||||
return nil, fmt.Errorf("invalid data in %v file, too short", t)
|
||||
}
|
||||
|
||||
nonce, ciphertext := buf[:r.key.NonceSize()], buf[r.key.NonceSize():]
|
||||
plaintext, err := r.key.Open(ciphertext[:0], nonce, ciphertext, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user