From 04dee2a46735029ea48c8bd7c3e097bc8045859d Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 11 Sep 2020 03:17:44 -0400 Subject: Fix bad allocation size due to BufferedTransformation::TransferMessagesTo2 (GH #962) --- cryptlib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cryptlib.cpp') diff --git a/cryptlib.cpp b/cryptlib.cpp index 929ed618..06a35079 100644 --- a/cryptlib.cpp +++ b/cryptlib.cpp @@ -647,7 +647,7 @@ size_t BufferedTransformation::TransferMessagesTo2(BufferedTransformation &targe while (AnyRetrievable()) { - transferredBytes = LWORD_MAX; + transferredBytes = (std::min)(LWORD_MAX, MaxRetrievable()); blockedBytes = TransferTo2(target, transferredBytes, channel, blocking); if (blockedBytes > 0) return blockedBytes; -- cgit v1.2.1