diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-11 12:44:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-11 12:44:23 +0300 |
commit | 05da7a15de40291b2135d8e089e24ec20babb065 (patch) | |
tree | 4be6dad7f3cb2a5ab7a31f9a5123893ed72cf20d /plugins/CloudFile/src/cloud_file.cpp | |
parent | bb583302ec9f478eebd3b57d06a476a5d82730c6 (diff) |
CloudFile: war agains static buffers & buffer overruns
Diffstat (limited to 'plugins/CloudFile/src/cloud_file.cpp')
-rw-r--r-- | plugins/CloudFile/src/cloud_file.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/CloudFile/src/cloud_file.cpp b/plugins/CloudFile/src/cloud_file.cpp index ed265f71aa..9e40ac3db0 100644 --- a/plugins/CloudFile/src/cloud_file.cpp +++ b/plugins/CloudFile/src/cloud_file.cpp @@ -70,19 +70,17 @@ void CCloudService::Report(MCONTACT hContact, const wchar_t *data) PasteToClipboard(data); } -char* CCloudService::PreparePath(const char *oldPath, char *newPath) +const char* CCloudService::PreparePath(const char *oldPath, CMStringA &newPath) { if (oldPath == nullptr) - mir_strcpy(newPath, ""); - else if (*oldPath != '/') - { - CMStringA result("/"); - result.Append(oldPath); - result.Replace("\\", "/"); - mir_strcpy(newPath, result); + newPath = ""; + else if (*oldPath != '/') { + newPath = "/"; + newPath.Append(oldPath); + newPath.Replace("\\", "/"); } - else - mir_strcpy(newPath, oldPath); + else newPath = oldPath; + return newPath; } |