Skip to content

Commit

Permalink
backport of commit 283ef77 (#17965)
Browse files Browse the repository at this point in the history
Co-authored-by: Brian Kassouf <briankassouf@users.noreply.github.com>
  • Loading branch information
1 parent 6b9c968 commit 4341446
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/17944.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
core: Fix potential deadlock if barrier ciphertext is less than 4 bytes.
```
2 changes: 2 additions & 0 deletions vault/barrier_aes_gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,13 @@ func (b *AESGCMBarrier) Decrypt(_ context.Context, key string, ciphertext []byte
}

if len(ciphertext) == 0 {
b.l.RUnlock()
return nil, fmt.Errorf("empty ciphertext")
}

// Verify the term
if len(ciphertext) < 4 {
b.l.RUnlock()
return nil, fmt.Errorf("invalid ciphertext term")
}
term := binary.BigEndian.Uint32(ciphertext[:4])
Expand Down

0 comments on commit 4341446

Please sign in to comment.