summaryrefslogtreecommitdiff
path: root/plugins/MenuItemEx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-09-25 14:47:38 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-09-25 14:47:38 +0300
commitd701a30b0f6c15241293a483fa3df95e5ce37efb (patch)
tree72a9814e748648ea8ce23bdec2e547b6e6ecce59 /plugins/MenuItemEx
parent3a3d3a6979adb9c1ab3ea34138f534414b634c20 (diff)
MenuItemEx: crash fix when processing DBVT_BLOB
Diffstat (limited to 'plugins/MenuItemEx')
-rw-r--r--plugins/MenuItemEx/src/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index 89882ab574..5c3f3873df 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -271,10 +271,12 @@ void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID, size_t dwIDSize)
mir_snprintf(szID, dwIDSize, "%u", dbv_uniqueid.dVal);
else if (dbv_uniqueid.type == DBVT_WORD)
mir_snprintf(szID, dwIDSize, "%u", dbv_uniqueid.wVal);
- else if (dbv_uniqueid.type == DBVT_BLOB)
- mir_snprintf(szID, dwIDSize, "%s", dbv_uniqueid.cpbVal);
- else
- strncpy_s(szID, dwIDSize, (char*)dbv_uniqueid.pszVal, _TRUNCATE);
+ else if (dbv_uniqueid.type == DBVT_BLOB) {
+ CMStringA tmp(' ', dbv_uniqueid.cpbVal*2);
+ bin2hex(dbv_uniqueid.pbVal, dbv_uniqueid.cpbVal, tmp.GetBuffer());
+ strncpy_s(szID, dwIDSize, tmp, _TRUNCATE);
+ }
+ else strncpy_s(szID, dwIDSize, (char*)dbv_uniqueid.pszVal, _TRUNCATE);
db_free(&dbv_uniqueid);
}