summaryrefslogtreecommitdiff
path: root/cryptlib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cryptlib.cpp')
-rw-r--r--cryptlib.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/cryptlib.cpp b/cryptlib.cpp
index c4463b0c..bf4577a9 100644
--- a/cryptlib.cpp
+++ b/cryptlib.cpp
@@ -405,8 +405,9 @@ RandomNumberGenerator & NullRNG()
bool HashTransformation::TruncatedVerify(const byte *digest, size_t digestLength)
{
+ // Allocate at least 1 for calculated to avoid triggering diagnostics
ThrowIfInvalidTruncatedSize(digestLength);
- SecByteBlock calculated(digestLength);
+ SecByteBlock calculated(digestLength ? digestLength : 1);
TruncatedFinal(calculated, digestLength);
return VerifyBufsEqual(calculated, digest, digestLength);
}