summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-09-22 19:31:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-09-22 19:31:17 +0000
commite79e9e44d8d960d56938f5948dc6b2d77db5b87a (patch)
tree3bb583dde034c5997ee9bb3adb1f0ca259315f0b
parent97c3f6fe20b6474159beb924c6707bef481faa14 (diff)
we don't allow to write resident settings for non-existent contacts
git-svn-id: http://svn.miranda-ng.org/main/trunk@10559 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index a73e89d640..fe6e12b592 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -458,6 +458,12 @@ LBL_WriteString:
mir_cslockfull lck(m_csDbAccess);
+ DWORD ofsBlobPtr, ofsContact = GetContactOffset(contactID);
+ if (ofsContact == 0) {
+ _ASSERT(false); // contact doesn't exist?
+ return 2;
+ }
+
char *szCachedSettingName = m_cache->GetCachedSetting(dbcwWork.szModule, dbcwWork.szSetting, moduleNameLen, settingNameLen);
log3("set [%08p] %s (%p)", hContact, szCachedSettingName, szCachedSettingName);
@@ -491,7 +497,6 @@ LBL_WriteString:
log1(" write database as %s", printVariant(&dbcwWork.value));
DWORD ofsModuleName = GetModuleNameOfs(dbcwWork.szModule);
- DWORD ofsBlobPtr, ofsContact = GetContactOffset(contactID);
DBContact dbc = *(DBContact*)DBRead(ofsContact, sizeof(DBContact), NULL);
if (dbc.signature != DBCONTACT_SIGNATURE)
return 1;