summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-16 18:24:07 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-16 18:24:07 +0000
commit6a18d15077999d208154ee13c0fc052f39c43e1f (patch)
treea85d9553a6673aa45b03d7980f457ef7c5b712ce
parent1d2bbcacaa044a84d7e32f11198a15e9d2f85b00 (diff)
fix for strncat use
git-svn-id: http://svn.miranda-ng.org/main/trunk@13637 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rwxr-xr-xplugins/New_GPG/src/main.cpp10
-rwxr-xr-xplugins/New_GPG/src/options.cpp4
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp4
3 files changed, 9 insertions, 9 deletions
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index b80f77184d..0437587688 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -2051,10 +2051,10 @@ void InitCheck()
{
TCHAR buf[4096];
_tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), SIZEOF(buf));
- _tcsncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), SIZEOF(buf));
- _tcsncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), SIZEOF(buf));
+ _tcsncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), SIZEOF(buf) - mir_tstrlen(buf));
+ _tcsncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), SIZEOF(buf) - mir_tstrlen(buf));
if(!gpg_valid)
- _tcsncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), SIZEOF(buf));
+ _tcsncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), SIZEOF(buf) - mir_tstrlen(buf));
MessageBox(0, buf, TranslateT("GPG plugin problems"), MB_OK);
}
if(!gpg_valid)
@@ -2304,8 +2304,8 @@ void ImportKey()
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- _tcsncat(tmp2, _T("\\"), MAX_PATH-1);
- _tcsncat(tmp2, _T("temporary_exported.asc"), MAX_PATH-1);
+ _tcsncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ _tcsncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
if(db_mc_isMeta(hContact))
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 85665d22cb..ee4a83d942 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -905,8 +905,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- _tcsncat(tmp2, _T("\\"), MAX_PATH-1);
- _tcsncat(tmp2, _T("temporary_exported.asc"), MAX_PATH-1);
+ _tcsncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ _tcsncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T(""));
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 349fd98e04..135a4df41f 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -1861,8 +1861,8 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- _tcsncat(tmp2, _T("\\"), MAX_PATH-1);
- _tcsncat(tmp2, _T("temporary_exported.asc"), MAX_PATH-1);
+ _tcsncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ _tcsncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
f<<toUTF16(key).c_str();