summaryrefslogtreecommitdiff
path: root/src/core/stdfile/filexferdlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/stdfile/filexferdlg.cpp')
-rw-r--r--src/core/stdfile/filexferdlg.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp
index 593008551e..bb69fdd495 100644
--- a/src/core/stdfile/filexferdlg.cpp
+++ b/src/core/stdfile/filexferdlg.cpp
@@ -493,9 +493,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename;
if ((pszExtension = _tcsrchr(pszFilename+1, '.')) == NULL) pszExtension = pszFilename+lstrlen(pszFilename);
if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename);
- pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*((pszExtension-szOriginalFilename)+21+lstrlen(pszExtension)));
+ size_t size = (pszExtension-szOriginalFilename)+21+lstrlen(pszExtension);
+ pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*size);
for (i = 1;;i++) {
- _stprintf((TCHAR*)pfr->szFilename, _T("%.*s (%u)%s"), pszExtension-szOriginalFilename, szOriginalFilename, i, pszExtension);
+ mir_sntprintf((TCHAR*)pfr->szFilename, size, _T("%.*s (%u)%s"), pszExtension-szOriginalFilename, szOriginalFilename, i, pszExtension);
if (_taccess(pfr->szFilename, 0) != 0)
break;
}