From 303e6b483aff4126701ca375dd085e9ae1d18b43 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sat, 13 Dec 2014 08:01:55 +0000 Subject: multiple buf size fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@11361 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FileAsMessage/src/dialog.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'plugins/FileAsMessage') diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 9cc63c3929..2b144d6048 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -884,16 +884,19 @@ int FILEECHO::sendCmd(int id, int cmd, char *szParam, char *szPrefix) void CreateDirectoryTree(char *szDir) { DWORD dwAttributes; - char *pszLastBackslash,szTestDir[MAX_PATH]; - - mir_tstrncpy(szTestDir,szDir,sizeof(szTestDir)); - if((dwAttributes=GetFileAttributes(szTestDir))!=0xffffffff - && dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return; - pszLastBackslash=strrchr(szTestDir,'\\'); - if(pszLastBackslash==NULL) {GetCurrentDirectory(MAX_PATH,szDir); return;} - *pszLastBackslash='\0'; + char *pszLastBackslash, szTestDir[MAX_PATH]; + + strncpy_s(szTestDir, szDir, _TRUNCATE); + if((dwAttributes = GetFileAttributes(szTestDir)) != 0xffffffff && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) + return; + pszLastBackslash = strrchr(szTestDir, '\\'); + if (pszLastBackslash == NULL) { + GetCurrentDirectory(MAX_PATH, szDir); + return; + } + *pszLastBackslash = 0; CreateDirectoryTree(szTestDir); - CreateDirectory(szTestDir,NULL); + CreateDirectory(szTestDir, NULL); } LRESULT CALLBACK ProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -- cgit v1.2.3