summaryrefslogtreecommitdiff
path: root/plugins/Import/src/mcontacts.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-04-25 12:54:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-04-25 12:54:22 +0300
commit462deb27452322b8540f6d31230e766760b817bb (patch)
tree3b65a39d7089730a444205cb1d0f9ccad6db302c /plugins/Import/src/mcontacts.cpp
parent644e81723335e445a7e53c6d858867ba416b31cd (diff)
first version of pattern import that could be compiled
Diffstat (limited to 'plugins/Import/src/mcontacts.cpp')
-rw-r--r--plugins/Import/src/mcontacts.cpp17
1 files changed, 12 insertions, 5 deletions
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);