diff options
Diffstat (limited to 'zencore/crypto.cpp')
| -rw-r--r-- | zencore/crypto.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/zencore/crypto.cpp b/zencore/crypto.cpp index 880d7b495..7fc524bf1 100644 --- a/zencore/crypto.cpp +++ b/zencore/crypto.cpp @@ -147,7 +147,8 @@ public: int TotalSize = 0; int DecryptedSize = 0; - int ErrorCode = EVP_DecryptUpdate(m_DecryptionCtx, + + int ErrorCode = EVP_DecryptUpdate(m_DecryptionCtx, reinterpret_cast<unsigned char*>(DecryptionBuffer.GetData()), &DecryptedSize, reinterpret_cast<const unsigned char*>(Data.GetData()), @@ -163,6 +164,11 @@ public: ErrorCode = EVP_DecryptFinal_ex(m_DecryptionCtx, reinterpret_cast<unsigned char*>(Remaining.GetData()), &DecryptedSize); + if (ErrorCode != 1) + { + return MemoryView(); + } + TotalSize += DecryptedSize; return DecryptionBuffer.Left(uint64_t(TotalSize)); |