summaryrefslogtreecommitdiff
path: root/plugins/Import
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-05-21 11:43:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-05-21 11:43:32 +0300
commit56358ea781acbbf3655e369e82507c55614c9b17 (patch)
treed051cf4e9def35b4a3d2621e5326afe36688bdc1 /plugins/Import
parent850dd08c679f8265491aad2cf04e5cb67db0a39a (diff)
Import: fix for setting correct blob size when importing from JSON
Diffstat (limited to 'plugins/Import')
-rw-r--r--plugins/Import/src/textjson.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/Import/src/textjson.cpp b/plugins/Import/src/textjson.cpp
index b6f890c86b..276a01e268 100644
--- a/plugins/Import/src/textjson.cpp
+++ b/plugins/Import/src/textjson.cpp
@@ -173,9 +173,10 @@ public:
}
dbei->flags |= DBEF_UTF;
- dbei->cbBlob = (DWORD)szBody.size() + offset + 2;
- dbei->pBlob = (PBYTE)mir_calloc(dbei->cbBlob);
- strcpy((char*)dbei->pBlob + offset, szBody.c_str());
+ dbei->cbBlob = (DWORD)szBody.size() + offset;
+ dbei->pBlob = (PBYTE)mir_calloc(dbei->cbBlob+1);
+ memcpy(dbei->pBlob + offset, szBody.c_str(), szBody.size());
+ dbei->pBlob[dbei->cbBlob] = 0;
}
return 0;