summaryrefslogtreecommitdiff
path: root/authenc.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2020-07-07 01:15:06 -0400
committerJeffrey Walton <noloader@gmail.com>2020-07-07 01:15:06 -0400
commita7b32867ddf8079e3bf02cc3983db091a95a3533 (patch)
tree6c8abc39bcb76bdacaf9e5a0ca04798ce31a5127 /authenc.cpp
parent9c5ea3a17e6007186acd23365ac5150feafc3bc5 (diff)
downloadcryptopp-git-a7b32867ddf8079e3bf02cc3983db091a95a3533.tar.gz
Add sanity check to AuthenticatedSymmetricCipherBase::TruncatedFinal (GH #954)
Diffstat (limited to 'authenc.cpp')
-rw-r--r--authenc.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/authenc.cpp b/authenc.cpp
index 2ac9362a..89a7142d 100644
--- a/authenc.cpp
+++ b/authenc.cpp
@@ -140,6 +140,9 @@ reswitch:
void AuthenticatedSymmetricCipherBase::TruncatedFinal(byte *mac, size_t macSize)
{
+ // https://github.com/weidai11/cryptopp/issues/954
+ this->ThrowIfInvalidTruncatedSize(macSize);
+
if (m_totalHeaderLength > MaxHeaderLength())
throw InvalidArgument(AlgorithmName() + ": header length of " + IntToString(m_totalHeaderLength) + " exceeds the maximum of " + IntToString(MaxHeaderLength()));