diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-04-21 19:15:27 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-04-21 19:15:27 +0000 |
commit | 6bf05d34ba416ec14f651c22cba8710e52125907 (patch) | |
tree | 9dd23676b4752495c6174d109a09863f8bb5ad1c /plugins/New_GPG/src/utilities.cpp | |
parent | 7e90e784060b968201c296ef5d0691c234398679 (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/utilities.cpp')
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 6fddc89a2e..ece87a569c 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -61,14 +61,14 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName); ofn.Flags=OFN_EXPLORER; ofn.lpstrTitle=TranslateW(WindowTittle); - _tcscpy(filter,TranslateW(szExtDesc)); + _tcsncpy(filter,TranslateW(szExtDesc), SIZEOF(filter)-1); pfilter=filter+_tcslen(filter)+1; _tcscpy(pfilter, szExt); pfilter[_tcslen(pfilter)+1] = '\0'; pfilter[_tcslen(pfilter)+2] = '\0'; ofn.lpstrFilter=filter; tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T("")); - _tcscpy(str, tmp); + _tcsncpy(str, tmp, SIZEOF(str)-1); mir_free(tmp); if(_tcslen(str)< 2) str[0] = '\0'; @@ -439,6 +439,7 @@ int onProtoAck(WPARAM w, LPARAM l) boost::filesystem::remove(filename); mir_free(filename); } + mir_free(filename); } } break; @@ -544,7 +545,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { supported_proto = true; ICQ_CUSTOMCAP cap = {0}; - strcpy(cap.caps, "GPG FileTransfer"); + strncpy(cap.caps, "GPGFileTransfer",sizeof(cap.caps)-1); if( ProtoCallService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) cap_found = true; } @@ -778,8 +779,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU { char *proto = ji->GetModuleName(); char setting[64]; - strcpy(setting, proto); - strcat(setting, "_KeyID"); + mir_snprintf(setting, sizeof(setting)-1,"%s_KeyID",proto); inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); if(!inkeyid[0]) { @@ -1860,10 +1860,10 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) DWORD exitcode; { 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); f<<toUTF16(key).c_str(); |