[fdo-commits] r2673 - trunk/Utilities/Common/Src
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Fri Mar 9 14:26:32 EST 2007
Author: jacklee
Date: 2007-03-09 14:26:32 -0500 (Fri, 09 Mar 2007)
New Revision: 2673
Modified:
trunk/Utilities/Common/Src/FdoCommonFile.cpp
Log:
Ticket #36
In Linux, the nul terminator is missing for the variable 'path' in the method FdoCommonFile::GetFileDirectoryAndName
Modified: trunk/Utilities/Common/Src/FdoCommonFile.cpp
===================================================================
--- trunk/Utilities/Common/Src/FdoCommonFile.cpp 2007-03-09 19:19:42 UTC (rev 2672)
+++ trunk/Utilities/Common/Src/FdoCommonFile.cpp 2007-03-09 19:26:32 UTC (rev 2673)
@@ -1159,24 +1159,29 @@
// extract the filename
if (pdest) {
- wchar_t lfilename[500];
+ size_t len = wcslen(pdest + 1) + 1;
+ wchar_t *lfilename = new wchar_t[len];
#ifdef _WIN32
- wcscpy_s(lfilename, 500, pdest + 1);
+ wcscpy_s(lfilename, len, pdest + 1);
#else
wcscpy(lfilename, pdest + 1);
#endif
filename = lfilename;
+ delete []lfilename;
}
// extract the directory name
if (index) {
- wchar_t path[500];
+ size_t len = index + 1;
+ wchar_t *path = new wchar_t[len];
#ifdef _WIN32
- wcsncpy_s(path, 500, location, index);
+ wcsncpy_s(path, len, location, index);
#else
wcsncpy(path, location, index);
+ path[index] = '\0';
#endif
directory = path;
+ delete []path;
}
return true;
More information about the fdo-commits
mailing list