diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-03-30 21:13:22 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-03-30 21:13:22 +0000 |
commit | 8f0f742e611059bd3b312aa9986e94e4bfc4e63e (patch) | |
tree | 781073b2e94dbdee9db0a69c3dd1b91f0614a110 /plugins/HTTPServer/src/IndexXML.cpp | |
parent | 3b49555625538d62f6e05c6b7bb4009314b54bc9 (diff) |
HTTPServer: Minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12566 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/HTTPServer/src/IndexXML.cpp')
-rw-r--r-- | plugins/HTTPServer/src/IndexXML.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 942e572433..443f410b1f 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -32,7 +32,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, char* pszSign = strchr(pszSrc, pszReplace);
if (pszSign) {
- strcpy(szBuffer, pszSrc);
+ strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1);
do {
strcpy(szBuffer + (pszSign - pszSrc), pszNew);
@@ -64,8 +64,8 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
const char * pszSrvPath, DWORD dwRemoteIP) {
char szMask[MAX_PATH+1];
- strcpy(szMask, pszRealPath);
- strcat(szMask, "*");
+ strncpy(szMask, pszRealPath, MAX_PATH);
+ strncat(szMask, "*", MAX_PATH);
WIN32_FIND_DATAA fdFindFileData;
HANDLE hFind = FindFirstFile(szMask, &fdFindFileData);
@@ -89,31 +89,31 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, DWORD dwBytesWritten = 0;
// Generate Dirname
- strcpy(szBuffer, pszSrvPath);
+ strncpy(szBuffer, pszSrvPath, BUFFER_SIZE);
char* pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
*pszTemp = '\0';
pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
- strcpy(szFileName, pszTemp + 1);
+ strncpy(szFileName, pszTemp + 1, MAX_PATH);
// Write Header
WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, NULL);
// check if a index.xsl exists in the same directory otherwise use the global
- strcpy(szMask, pszRealPath);
- strcat(szMask, "index.xsl");
+ strncpy(szMask, pszRealPath, MAX_PATH);
+ strncat(szMask, "index.xsl", MAX_PATH);
HANDLE hFileExists = CreateFile(szMask, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFileExists == INVALID_HANDLE_VALUE) {
- strcpy(szBuffer, "/index.xsl");
+ strncpy(szBuffer, "/index.xsl", BUFFER_SIZE);
} else {
CloseHandle(hFileExists);
- strcpy(szBuffer, "index.xsl");
+ strncpy(szBuffer, "index.xsl", BUFFER_SIZE);
}
WriteFile(hFile, szBuffer, (DWORD)strlen(szBuffer), &dwBytesWritten, NULL);
|