From 2499bf1bad239a8316c32932a993642350b3afdb Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Thu, 22 Apr 2021 13:09:18 -0400 Subject: [PATCH] Fix potential DoS in Decrypt --- state.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/state.go b/state.go index c4c766f..6e9577f 100644 --- a/state.go +++ b/state.go @@ -62,8 +62,11 @@ func (s *CipherState) Decrypt(out, ad, ciphertext []byte) ([]byte, error) { return nil, ErrMaxNonce } out, err := s.c.Decrypt(out, s.n, ad, ciphertext) + if err != nil { + return nil, err + } s.n++ - return out, err + return out, nil } // Cipher returns the low-level symmetric encryption primitive. It should only