[fdo-commits] r830 - branches/3.2.x/Utilities/Common/Src
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Fri Mar 9 13:04:06 EST 2007
Author: jacklee
Date: 2007-03-09 13:04:06 -0500 (Fri, 09 Mar 2007)
New Revision: 830
Modified:
branches/3.2.x/Utilities/Common/Src/FdoCommonFile.cpp
Log:
In FdoCommonFile::GetFileDirectoryAndName, add the nul terminator for the variable path.
Modified: branches/3.2.x/Utilities/Common/Src/FdoCommonFile.cpp
===================================================================
--- branches/3.2.x/Utilities/Common/Src/FdoCommonFile.cpp 2007-03-08 23:08:12 UTC (rev 829)
+++ branches/3.2.x/Utilities/Common/Src/FdoCommonFile.cpp 2007-03-09 18:04:06 UTC (rev 830)
@@ -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