aboutsummaryrefslogtreecommitdiff
path: root/internal/crypt/rawDecrypt.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/crypt/rawDecrypt.go')
-rw-r--r--internal/crypt/rawDecrypt.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/crypt/rawDecrypt.go b/internal/crypt/rawDecrypt.go
index 30a202f..b82f0fb 100644
--- a/internal/crypt/rawDecrypt.go
+++ b/internal/crypt/rawDecrypt.go
@@ -26,6 +26,10 @@ func DecryptRawBytes(inputBytes []byte, password []byte) ([]byte, error) {
return nil, fmt.Errorf("decrypt: failed to parse header length: %w", err)
}
+ if headerLen < 0 || idx+1+headerLen > len(inputBytes) {
+ return nil, fmt.Errorf("decrypt: invalid header length %d", headerLen)
+ }
+
headerBytes := inputBytes[idx+1 : idx+1+headerLen]
headers, err := utils.GetFileHeaders(headerBytes)
if err != nil {