From 3454255df72799b6127def97f1445d39dfb3eda5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Dec 2017 18:02:31 +0300 Subject: fixes #1049 (memset cannot be used to scrub memory) --- plugins/CryptoPP/src/GPGw/gpg_main.cpp | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 2 +- plugins/Variables/src/parse_str.cpp | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/CryptoPP/src/GPGw/gpg_main.cpp b/plugins/CryptoPP/src/GPGw/gpg_main.cpp index 5bbbc9f5e3..311d7daa7c 100644 --- a/plugins/CryptoPP/src/GPGw/gpg_main.cpp +++ b/plugins/CryptoPP/src/GPGw/gpg_main.cpp @@ -250,7 +250,7 @@ LPSTR __cdecl _gpg_decrypt(LPCSTR message) if ( gpgresult==gpgSuccess && useridvalid==TRUE) addPassphrase(keyuserid, passphrase); - memset(passphrase, 0, sizeof(passphrase)); + SecureZeroMemory(passphrase, sizeof(passphrase)); size_t decmessagelen = strlen(buffer)+1; decmessage = (char *) LocalAlloc(LPTR,decmessagelen); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 882efd9083..ab168d8ee0 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -311,7 +311,7 @@ void SendQueue::clearJob(const int iIndex) { SendJob &job = m_jobs[iIndex]; mir_free(job.szSendBuffer); - memset(&job, 0, sizeof(SendJob)); + SecureZeroMemory(&job, sizeof(SendJob)); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 81207853b1..f13b4a0252 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -486,8 +486,6 @@ static wchar_t *parseStrchr(ARGUMENTSINFO *ai) if (ai->argc != 3) return nullptr; - char *szVal[34]; - memset(szVal, 0, sizeof(szVal)); wchar_t *c = wcschr(ai->targv[1], *ai->targv[2]); if (c == nullptr || *c == 0) return mir_wstrdup(L"0"); -- cgit v1.2.3