summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-11 20:06:43 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-11 20:06:43 +0300
commit6607b3e491653046d492e9403b4edf669cd40ecb (patch)
treed956f1a376945845ca7d56f0e4e3b8be83984d13 /plugins
parentab544cb8edebd9576fffc1a05d25843d03c1e379 (diff)
fixes #4041 (Падение при попытке импортировать историю в контакта YAMN)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Import/src/import.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 2ad6ce1605..e743d13cc8 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -878,8 +878,6 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int
else hDst = NULL;
bool bSkipAll = false;
- int cbAlloc = 4096;
- uint8_t *eventBuf = (uint8_t*)mir_alloc(cbAlloc);
// Get the start of the event chain
int i = 0;
@@ -888,16 +886,12 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int
i++;
// Copy the event and import it
- DBEVENTINFO dbei = {};
+ DB::EventInfo dbei;
dbei.cbBlob = srcDb->GetBlobSize(hEvent);
- if (dbei.cbBlob > cbAlloc) {
- cbAlloc = dbei.cbBlob + 4096 - dbei.cbBlob % 4096;
- eventBuf = (uint8_t*)mir_realloc(eventBuf, cbAlloc);
- }
- dbei.pBlob = eventBuf;
+ dbei.pBlob = (uint8_t*)mir_alloc(dbei.cbBlob+1);
bool bSkipThis = false;
- if (!srcDb->GetEvent(hEvent, &dbei)) {
+ if (!srcDb->GetEvent(hEvent, &dbei)) {
if (dbei.szModule == nullptr)
dbei.szModule = szProto;
@@ -982,7 +976,6 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int
if (bSkipAll)
break;
}
- mir_free(eventBuf);
}
/////////////////////////////////////////////////////////////////////////////////////////