summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-06 17:34:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-06 17:34:44 +0000
commite6b3e7ec6e00806426282a428b299272054baa88 (patch)
treeb01bd16575e53bb2f920e21608c134876d58ba13 /plugins
parent108d0abc52b5a37be5b07d54aa31394224f671c2 (diff)
fix for decrypting events
git-svn-id: http://svn.miranda-ng.org/main/trunk@7524 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 155aa04eee..843a48b31b 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -387,15 +387,16 @@ void CDb3Mmap::ToggleEventsEncryption(HANDLE hContact)
// fast cycle through all events
for (DWORD offset = contact.ofsFirstEvent; offset != 0;) {
- DBEvent evt = *(DBEvent*)DBRead(offset, sizeof(DBEvent), NULL);
+ DBEvent evt = *(DBEvent*)DBRead(offset, offsetof(DBEvent, blob), NULL);
if (evt.signature != DBEVENT_SIGNATURE)
return;
size_t len;
DWORD ofsDest;
mir_ptr<BYTE> pBlob;
+ BYTE *pSource = DBRead(offset + offsetof(DBEvent, blob), evt.cbBlob, 0);
if (!m_bEncrypted) { // we need more space
- if ((pBlob = m_crypto->encodeBuffer(DBRead(offset + offsetof(DBEvent, blob), evt.cbBlob, 0), evt.cbBlob, &len)) == NULL)
+ if ((pBlob = m_crypto->encodeBuffer(pSource, evt.cbBlob, &len)) == NULL)
return;
ofsDest = ReallocSpace(offset, offsetof(DBEvent, blob) + evt.cbBlob, offsetof(DBEvent, blob) + (DWORD)len);
@@ -420,7 +421,7 @@ void CDb3Mmap::ToggleEventsEncryption(HANDLE hContact)
evt.flags |= DBEF_ENCRYPTED;
}
else {
- if ((pBlob = (BYTE*)m_crypto->decodeBuffer(evt.blob, evt.cbBlob, &len)) == NULL)
+ if ((pBlob = (BYTE*)m_crypto->decodeBuffer(pSource, evt.cbBlob, &len)) == NULL)
return;
ofsDest = offset; // reuse the old space