From a41c3238e5dadf27751c5b0e50a5dbe6c52b3804 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Feb 2019 12:49:22 +0300 Subject: fixes #1832 (FTPFile: crash on filetransfer) --- plugins/FTPFileYM/src/job_generic.h | 2 +- plugins/FTPFileYM/src/job_upload.cpp | 10 ++++------ plugins/FTPFileYM/src/version.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'plugins/FTPFileYM/src') diff --git a/plugins/FTPFileYM/src/job_generic.h b/plugins/FTPFileYM/src/job_generic.h index b81c6e5f5e..f8ce9f36a9 100644 --- a/plugins/FTPFileYM/src/job_generic.h +++ b/plugins/FTPFileYM/src/job_generic.h @@ -71,7 +71,7 @@ public: ServerList::FTP *m_ftp; wchar_t m_tszFilePath[1024]; wchar_t m_tszFileName[64]; - char m_szSafeFileName[64]; + char m_szSafeFileName[256]; EMode m_mode; EStatus m_status; diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index ba88b9c48d..04eca7a490 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -238,18 +238,16 @@ bool UploadJob::fileExistsOnServer() ///////////////////////////////////////////////////////////////////////////////////////// -const wchar_t from_chars[] = L"абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ !@#$%^&=,{}[];'`"; -const wchar_t to_chars[] = L"abvgdeezziiklmnoprstufhccwwqyqeuaABVGDEEZZIIKLMNOPRSTUFHCCWWQYQEUA_________________"; +const wchar_t from_chars[] = L" !@#$%^&=,{}[];'`"; void UploadJob::makeSafeString(const wchar_t *input) { CMStringW tmp(input); - size_t len = mir_wstrlen(from_chars); - for (size_t i = 0; i < len; i++) - tmp.Replace(from_chars[i], to_chars[i]); + for (size_t i = 0; i < _countof(from_chars)-1; i++) + tmp.Replace(from_chars[i], '_'); - strncpy(this->m_szSafeFileName, _T2A(tmp), _TRUNCATE); + strncpy_s(m_szSafeFileName, T2Utf(tmp), _TRUNCATE); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/FTPFileYM/src/version.h b/plugins/FTPFileYM/src/version.h index 45859d8f11..9a2675aadf 100644 --- a/plugins/FTPFileYM/src/version.h +++ b/plugins/FTPFileYM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 6 #define __RELEASE_NUM 0 -#define __BUILD_NUM 4 +#define __BUILD_NUM 5 #include -- cgit v1.2.3