From 462deb27452322b8540f6d31230e766760b817bb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Apr 2019 12:54:22 +0300 Subject: first version of pattern import that could be compiled --- plugins/Import/src/mcontacts.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'plugins/Import/src/mcontacts.cpp') diff --git a/plugins/Import/src/mcontacts.cpp b/plugins/Import/src/mcontacts.cpp index 9cf8b12401..748881538b 100644 --- a/plugins/Import/src/mcontacts.cpp +++ b/plugins/Import/src/mcontacts.cpp @@ -27,11 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HEADER_STR "HB" -static int mc_makeDatabase(const wchar_t*) -{ - return 1; -} - ///////////////////////////////////////////////////////////////////////////////////////// // CDbxMcontacts database driver, read-only @@ -126,11 +121,15 @@ public: if (dwSize == sizeof(MC_MsgHeader32)) { MC_MsgHeader32 hdr; r = ReadFile(m_hFile, &hdr, sizeof(hdr), &dwRead, 0); + if (!r || dwRead < sizeof(hdr)) + return; SetFilePointer(m_hFile, hdr.cbBlob, 0, FILE_CURRENT); } else { MC_MsgHeader64 hdr; r = ReadFile(m_hFile, &hdr, sizeof(hdr), &dwRead, 0); + if (!r || dwRead < sizeof(hdr)) + return; SetFilePointer(m_hFile, hdr.cbBlob, 0, FILE_CURRENT); } pos += dwSize; @@ -243,6 +242,14 @@ public: } }; +///////////////////////////////////////////////////////////////////////////////////////// +// database link functions + +static int mc_makeDatabase(const wchar_t*) +{ + return 1; +} + static int mc_grokHeader(const wchar_t *profile) { return CDbxMc().Open(profile); -- cgit v1.2.3