Skip to content

Commit

Permalink
handle overflow error
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley committed Jun 11, 2024
1 parent 2e795af commit 36fd6e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/integrations/oauth/crypt/crypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func Encrypt(data string, passphrase string) (string, error) {
}

plaintext := []byte(data)
if len(plaintext) > 1028 {
return "", fmt.Errorf("plaintext too long")
}
ciphertext := make([]byte, aes.BlockSize+len(plaintext))
iv := ciphertext[:aes.BlockSize]
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
Expand Down

0 comments on commit 36fd6e4

Please sign in to comment.