From 4b425310e632cd9f6fd6c7d76089d8889872bcb4 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 27 Mar 2018 02:02:40 +0300 Subject: plugins: new_gpg - ptrA memory corruption regression fix - fixed broken xep-0027 prescense sigining regression caused by refectoring ( fixes #1131 ) --- plugins/New_GPG/src/utilities.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index a9acfe95af..7ec25605b9 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -694,7 +694,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) DWORD code; std::vector cmd; { - ptrA inkeyid; + char* inkeyid = nullptr; char setting[64]; mir_snprintf(setting, sizeof(setting) - 1, "%s_KeyID", ji->GetModuleName()); @@ -711,8 +711,10 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), L""); if (pass[0] && globals.bDebugLog) - globals.debuglog << std::string(time_str() + ": info: found password in database for key ID: " + inkeyid.get() + ", trying to encrypt message from self with password"); + globals.debuglog << std::string(time_str() + ": info: found password in database for key ID: " + inkeyid + ", trying to encrypt message from self with password"); } + if (inkeyid && inkeyid[0]) + mir_free(inkeyid); else { pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", L""); if (pass[0] && globals.bDebugLog) @@ -722,7 +724,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) cmd.push_back(L"--passphrase"); cmd.push_back(pass.get()); } - else if (globals.password) { + else if (globals.password && globals.password[0]) { if (globals.bDebugLog) globals.debuglog << std::string(time_str() + ": info: found password in memory, trying to encrypt message from self with password"); cmd.push_back(L"--passphrase"); -- cgit v1.2.3