diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-02 03:47:27 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-02 03:47:27 +0000 |
commit | 6e2b6b31bae6d69bff5271451e73eb08637b8118 (patch) | |
tree | ca636f1497e4cc6980736d56a7ff61e3a6f88079 /src/core | |
parent | d83beb598f0944dcb944524b1d27525dc320cf18 (diff) |
mir_sntprintf(..., _T("%s"), ...) -> _tcsncpy_s(..., ..., _TRUNCATE)
fix some x64 ptr truncations
git-svn-id: http://svn.miranda-ng.org/main/trunk@11211 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdauth/auth.cpp | 2 | ||||
-rw-r--r-- | src/core/stdauth/authdialogs.cpp | 8 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 2 | ||||
-rw-r--r-- | src/core/stdfile/filexferdlg.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/src/core/stdauth/auth.cpp b/src/core/stdauth/auth.cpp index f2cfaa041b..df3ea40221 100644 --- a/src/core/stdauth/auth.cpp +++ b/src/core/stdauth/auth.cpp @@ -75,7 +75,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_sntprintf(szUid, SIZEOF(szUid), _T("%s"), ci.pszVal);
+ _tcsncpy_s(szUid, ci.pszVal, _TRUNCATE);
mir_free(ci.pszVal);
break;
diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 99000a8663..fbbc377047 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -72,10 +72,10 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (off)
mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), nickT);
else
- mir_sntprintf(name, SIZEOF(name), _T("%s"), nickT);
+ _tcsncpy_s(name, nickT, _TRUNCATE);
}
if (!name[0])
- _tcscpy(name, TranslateT("<Unknown>"));
+ _tcsncpy_s(name, TranslateT("<Unknown>"), _TRUNCATE);
TCHAR hdr[256];
if (uin && emailT[0])
@@ -197,10 +197,10 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (off)
mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), (TCHAR*)nickT);
else
- mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)nickT);
+ _tcsncpy_s(name, nickT, _TRUNCATE);
}
if (!name[0])
- _tcscpy(name, TranslateT("<Unknown>"));
+ _tcsncpy_s(name, TranslateT("<Unknown>"), _TRUNCATE);
TCHAR hdr[256];
if (uin && emailT[0])
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 2d9b797540..75be4f1bbc 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -2387,7 +2387,7 @@ LABEL_SHOWWINDOW: MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
if (pInfo) {
TCHAR szFile[MAX_PATH], szName[MAX_PATH], szFolder[MAX_PATH];
- mir_sntprintf(szName, MAX_PATH, _T("%s"), pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule));
+ _tcsncpy_s(szName, (pInfo->ptszModDispName ? pInfo->ptszModDispName : _A2T(si->pszModule)), _TRUNCATE);
ValidateFilename(szName);
mir_sntprintf(szFolder, MAX_PATH, _T("%s\\%s"), g_Settings.pszLogDir, szName);
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index 962283e9b0..3bf08dc08d 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -108,8 +108,8 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) info->szFile[_tcslen(info->szFile) - 1] = '\0'; *pszReplace = 0; mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2); - } - else mir_tstrncpy(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine)); + } else + _tcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); PROCESS_INFORMATION pi; if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index d7e9870415..8bb5a9ce11 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1002,7 +1002,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_sntprintf(buf, SIZEOF(buf), _T("%s"), ci.pszVal);
+ _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
mir_free(ci.pszVal);
break;
@@ -1113,7 +1113,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
- mir_sntprintf(buf, SIZEOF(buf), _T("%s"), (TCHAR*)ci.pszVal);
+ _tcsncpy_s(buf, ci.pszVal, _TRUNCATE);
mir_free(ci.pszVal);
break;
case CNFT_DWORD:
|