diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-26 17:39:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-26 17:39:27 +0000 |
commit | 0ae0d8793303452256f70946428a7f51466a60af (patch) | |
tree | f4c5dcbcd9ffde65aaaf9f119adc77891f2c5471 /plugins | |
parent | dbbf4f80b0774a3880989458cd1519e29e959f54 (diff) |
fix against crash while opening read-only databases
git-svn-id: http://svn.miranda-ng.org/main/trunk@7910 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Db3x_mmap/src/dbcrypt.cpp | 9 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbsettings.cpp | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 8af1b93b2f..84b66402e3 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -132,7 +132,7 @@ int CDb3Mmap::InitCrypt() CRYPTO_PROVIDER *pProvider;
DBVARIANT dbv = { 0 };
- dbv.type = DBVT_ASCIIZ;
+ dbv.type = DBVT_BLOB;
DBCONTACTGETSETTING dbcgs = { "CryptoEngine", "Provider", &dbv };
if (GetContactSettingStr(NULL, &dbcgs)) {
LBL_CreateProvider:
@@ -145,12 +145,13 @@ LBL_CreateProvider: pProvider = ppProvs[0]; //!!!!!!!!!!!!!!!!!!
DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" };
- dbcws.value.type = DBVT_ASCIIZ;
- dbcws.value.pszVal = pProvider->pszName;
+ dbcws.value.type = DBVT_BLOB;
+ dbcws.value.pbVal = (PBYTE)pProvider->pszName;
+ dbcws.value.cpbVal = (int)strlen(pProvider->pszName)+1;
WriteContactSetting(NULL, &dbcws);
}
else {
- pProvider = Crypto_GetProvider(dbv.pszVal);
+ pProvider = Crypto_GetProvider(LPCSTR(dbv.pbVal));
FreeVariant(&dbv);
if (pProvider == NULL)
goto LBL_CreateProvider;
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index 29e92eb393..18d14fa7ab 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -357,7 +357,7 @@ STDMETHODIMP_(BOOL) CDb3Base::SetSettingResident(BOOL bIsResident, const char *p STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRITESETTING *dbcws)
{
- if (dbcws == NULL || dbcws->szSetting == NULL || dbcws->szModule == NULL)
+ if (dbcws == NULL || dbcws->szSetting == NULL || dbcws->szModule == NULL || m_bReadOnly)
return 1;
// the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name
|