diff options
author | Tobias Fella <fella@posteo.de> | 2022-05-19 21:58:54 +0200 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2022-05-19 21:58:54 +0200 |
commit | a8076b9a2394150e11381dc8fc2e3af2bbd03f39 (patch) | |
tree | c49c7683683c35e6528a1f81c51c8f1bd074ed8c /lib/events | |
parent | 10197b03cc354f69b9d3cc028d00cf3df00ca91f (diff) | |
download | libquotient-a8076b9a2394150e11381dc8fc2e3af2bbd03f39.tar.gz libquotient-a8076b9a2394150e11381dc8fc2e3af2bbd03f39.zip |
Fix cipher text buffer initialization
Diffstat (limited to 'lib/events')
-rw-r--r-- | lib/events/encryptedfile.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/events/encryptedfile.cpp b/lib/events/encryptedfile.cpp index d35ee28f..9cc3a0c8 100644 --- a/lib/events/encryptedfile.cpp +++ b/lib/events/encryptedfile.cpp @@ -64,7 +64,7 @@ std::pair<EncryptedFile, QByteArray> EncryptedFile::encryptFile(const QByteArray int length; auto* ctx = EVP_CIPHER_CTX_new(); - QByteArray cipherText(plainText.size(), plainText.size() + EVP_MAX_BLOCK_LENGTH - 1); + QByteArray cipherText(plainText.size() + EVP_MAX_BLOCK_LENGTH - 1, '\0'); EVP_EncryptInit_ex(ctx, EVP_aes_256_ctr(), nullptr, reinterpret_cast<const unsigned char*>(k.data()),reinterpret_cast<const unsigned char*>(iv.data())); EVP_EncryptUpdate(ctx, reinterpret_cast<unsigned char*>(cipherText.data()), &length, reinterpret_cast<const unsigned char*>(plainText.data()), plainText.size()); EVP_EncryptFinal_ex(ctx, reinterpret_cast<unsigned char*>(cipherText.data()) + length, &length); |