Skip to content

Commit 2499bf1

Browse files
committed
Fix potential DoS in Decrypt
1 parent 927fa1b commit 2499bf1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

state.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@ func (s *CipherState) Decrypt(out, ad, ciphertext []byte) ([]byte, error) {
6262
return nil, ErrMaxNonce
6363
}
6464
out, err := s.c.Decrypt(out, s.n, ad, ciphertext)
65+
if err != nil {
66+
return nil, err
67+
}
6568
s.n++
66-
return out, err
69+
return out, nil
6770
}
6871

6972
// Cipher returns the low-level symmetric encryption primitive. It should only

0 commit comments

Comments
 (0)