summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src/options.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-04-21 19:15:27 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-04-21 19:15:27 +0000
commit6bf05d34ba416ec14f651c22cba8710e52125907 (patch)
tree9dd23676b4752495c6174d109a09863f8bb5ad1c /plugins/New_GPG/src/options.cpp
parent7e90e784060b968201c296ef5d0691c234398679 (diff)
New_GPG:
- Fixed some buffer overruns (char caps[0x10]; and strcpy(cap.caps, "GPG FileTransfer"); ) git-svn-id: http://svn.miranda-ng.org/main/trunk@13018 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src/options.cpp')
-rwxr-xr-xplugins/New_GPG/src/options.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 59c21f0a43..85665d22cb 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -360,19 +360,21 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
- memcpy(szKey, str.c_str(), str.size());
- szKey[str.size()] = '\0';
- str.clear();
- EmptyClipboard();
- GlobalUnlock(hMem);
- if(!SetClipboardData(CF_OEMTEXT, hMem))
- {
- GlobalFree(hMem);
- TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
- MessageBox(0, msg, TranslateT("Error"), MB_OK);
+ else {
+ memcpy(szKey, str.c_str(), str.size());
+ szKey[str.size()] = '\0';
+ str.clear();
+ EmptyClipboard();
+ GlobalUnlock(hMem);
+ if(!SetClipboardData(CF_OEMTEXT, hMem))
+ {
+ GlobalFree(hMem);
+ TCHAR msg[64];
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ MessageBox(0, msg, TranslateT("Error"), MB_OK);
+ }
+ CloseClipboard();
}
- CloseClipboard();
}
else
{
@@ -901,10 +903,10 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
MCONTACT hcnt = db_mc_tryMeta(hContact);
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
- _tcscpy(tmp2, ptmp);
+ _tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- _tcscat(tmp2, _T("\\"));
- _tcscat(tmp2, _T("temporary_exported.asc"));
+ _tcsncat(tmp2, _T("\\"), MAX_PATH-1);
+ _tcsncat(tmp2, _T("temporary_exported.asc"), MAX_PATH-1);
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T(""));