summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-16 18:09:55 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-16 18:09:55 +0000
commit5b2ebe7fef3a15c5db381816241bf16850c8176a (patch)
treefbe3a0302f1d9ce28b82d04aa4474e38f9768044
parente425f74c45bf3d947f625599d1464c5591544487 (diff)
fix for strncat use
git-svn-id: http://svn.miranda-ng.org/main/trunk@13634 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/HTTPServer/src/IndexHTML.cpp4
-rw-r--r--plugins/HTTPServer/src/IndexXML.cpp4
-rw-r--r--plugins/HTTPServer/src/main.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp
index 89fc56f157..fed678827d 100644
--- a/plugins/HTTPServer/src/IndexHTML.cpp
+++ b/plugins/HTTPServer/src/IndexHTML.cpp
@@ -63,7 +63,7 @@ bool LoadIndexHTMLTemplate() {
char* pszDestBuf = szDestBuf;
strncpy(pszBuf, szPluginPath, SIZEOF(szBuf)-1);
- strncat(pszBuf, szIndexHTMLTemplateFile, SIZEOF(szBuf)-1);
+ strncat(pszBuf, szIndexHTMLTemplateFile, SIZEOF(szBuf) - mir_strlen(szBuf));
HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -284,7 +284,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath,
// check if directory exists
char szMask[MAX_PATH];
strncpy(szMask, pszRealPath, MAX_PATH- 1);
- strncat(szMask, "*", MAX_PATH- 1);
+ strncat(szMask, "*", SIZEOF(szMask) - mir_strlen(szMask));
WIN32_FIND_DATAA fdFindFileData;
HANDLE hFind = FindFirstFile(szMask, &fdFindFileData);
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp
index 443f410b1f..0e98cd8cca 100644
--- a/plugins/HTTPServer/src/IndexXML.cpp
+++ b/plugins/HTTPServer/src/IndexXML.cpp
@@ -65,7 +65,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
const char * pszSrvPath, DWORD dwRemoteIP) {
char szMask[MAX_PATH+1];
strncpy(szMask, pszRealPath, MAX_PATH);
- strncat(szMask, "*", MAX_PATH);
+ strncat(szMask, "*", SIZEOF(szMask) - mir_strlen(szMask));
WIN32_FIND_DATAA fdFindFileData;
HANDLE hFind = FindFirstFile(szMask, &fdFindFileData);
@@ -103,7 +103,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
// check if a index.xsl exists in the same directory otherwise use the global
strncpy(szMask, pszRealPath, MAX_PATH);
- strncat(szMask, "index.xsl", MAX_PATH);
+ strncat(szMask, "index.xsl", SIZEOF(szMask) - mir_strlen(szMask));
HANDLE hFileExists = CreateFile(szMask, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp
index 361aedcbb8..0dab60b744 100644
--- a/plugins/HTTPServer/src/main.cpp
+++ b/plugins/HTTPServer/src/main.cpp
@@ -900,7 +900,7 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) {
MessageBox(NULL, _T("Failed to retrieve plugin path."), MSG_BOX_TITEL, MB_OK);
return 1;
}
- _tcsncat(szPluginPath,_T("\\HTTPServer\\"), MAX_PATH);
+ _tcsncat(szPluginPath, _T("\\HTTPServer\\"), SIZEOF(szPluginPath) - mir_tstrlen(szPluginPath));
int err = CreateDirectoryTree(szPluginPath);
if((err != 0) && (err != ERROR_ALREADY_EXISTS))
{