Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Geyer <debfx@fobos.de>2010-09-18 19:13:28 +0400
committerFelix Geyer <debfx@fobos.de>2010-09-18 19:13:28 +0400
commit36d974649e23ab6fe31c3046833410da291f5f5f (patch)
tree2042ee1c15af315f8b8a3d543b3f39f8c747f614 /src
parentc2bdfab158da4be7d422a768a3d481cbbd814370 (diff)
Write the remaining buffer in reset().
Diffstat (limited to 'src')
-rw-r--r--src/streams/SymmetricCipherStream.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/streams/SymmetricCipherStream.cpp b/src/streams/SymmetricCipherStream.cpp
index 30963bd7a..be3536331 100644
--- a/src/streams/SymmetricCipherStream.cpp
+++ b/src/streams/SymmetricCipherStream.cpp
@@ -29,11 +29,18 @@ SymmetricCipherStream::SymmetricCipherStream(QIODevice* baseDevice, SymmetricCip
bool SymmetricCipherStream::reset()
{
+ if (isWritable()) {
+ if (!writeBlock()) {
+ return false;
+ }
+ }
+
m_buffer.clear();
m_bufferPos = 0;
m_bufferFilling = false;
m_error = false;
m_cipher->reset();
+
return true;
}
@@ -133,6 +140,7 @@ bool SymmetricCipherStream::writeBlock()
return true;
}
else if (m_buffer.size() != m_cipher->blockSize()) {
+ // PKCS7 padding
int padLen = m_cipher->blockSize() - m_buffer.size();
for (int i=m_buffer.size(); i<m_cipher->blockSize(); i++) {
m_buffer.append(static_cast<char>(padLen));