summaryrefslogtreecommitdiff
path: root/indra/llvfs
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2018-01-12 09:08:49 -0500
committerJonathan Yap <jhwelch@gmail.com>2018-01-12 09:08:49 -0500
commit1e586749efeeb8c40503330572680a8709ae5487 (patch)
tree5c1ebee5dbdb5004f354b9fb0837d60f6dd3cfcc /indra/llvfs
parent32f16633c77564d567ed0752e56eb38abb916ccd (diff)
parent1693ccba58eef676df1f91e50627545ac35bb819 (diff)
STORM-2145 Merge up to viewer-release
Diffstat (limited to 'indra/llvfs')
-rw-r--r--indra/llvfs/lldir.cpp27
-rw-r--r--indra/llvfs/lldiriterator.cpp4
-rw-r--r--indra/llvfs/llvfs.cpp11
-rw-r--r--indra/llvfs/llvfs.h1
4 files changed, 38 insertions, 5 deletions
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 86a15f2ef2..b845de71fa 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -104,8 +104,13 @@ LLDir::~LLDir()
std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
{
//Returns a vector of fullpath filenames.
-
- boost::filesystem::path p (dirname);
+
+#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
+ boost::filesystem::path p(utf8str_to_utf16str(dirname));
+#else
+ boost::filesystem::path p(dirname);
+#endif
+
std::vector<std::string> v;
if (exists(p))
@@ -193,7 +198,12 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name)
try
{
- boost::filesystem::path dir_path(dir_name);
+#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
+ boost::filesystem::path dir_path(utf8str_to_utf16str(dir_name));
+#else
+ boost::filesystem::path dir_path(dir_name);
+#endif
+
if (boost::filesystem::exists (dir_path))
{
if (!boost::filesystem::is_empty (dir_path))
@@ -720,6 +730,15 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
<< ((constraint == CURRENT_SKIN)? "CURRENT_SKIN" : "ALL_SKINS")
<< LL_ENDL;
+ // Build results vector.
+ std::vector<std::string> results;
+ // Disallow filenames that may escape subdir
+ if (filename.find("..") != std::string::npos)
+ {
+ LL_WARNS("LLDir") << "Ignoring potentially relative filename '" << filename << "'" << LL_ENDL;
+ return results;
+ }
+
// Cache the default language directory for each subdir we've encountered.
// A cache entry whose value is the empty string means "not localized,
// don't bother checking again."
@@ -784,8 +803,6 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir,
}
}
- // Build results vector.
- std::vector<std::string> results;
// The process we use depends on 'constraint'.
if (constraint != CURRENT_SKIN) // meaning ALL_SKINS
{
diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp
index 76296ff877..3eb64e69d9 100644
--- a/indra/llvfs/lldiriterator.cpp
+++ b/indra/llvfs/lldiriterator.cpp
@@ -51,7 +51,11 @@ private:
LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
: mIsValid(false)
{
+#ifdef LL_WINDOWS // or BOOST_WINDOWS_API
+ fs::path dir_path(utf8str_to_utf16str(dirname));
+#else
fs::path dir_path(dirname);
+#endif
bool is_dir = false;
diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp
index 1cc0e819db..db0eac7031 100644
--- a/indra/llvfs/llvfs.cpp
+++ b/indra/llvfs/llvfs.cpp
@@ -2114,6 +2114,17 @@ void LLVFS::dumpFiles()
LL_INFOS() << "Extracted " << files_extracted << " files out of " << mFileBlocks.size() << LL_ENDL;
}
+time_t LLVFS::creationTime()
+{
+ llstat data_file_stat;
+ int errors = LLFile::stat(mDataFilename, &data_file_stat);
+ if (0 == errors)
+ {
+ return data_file_stat.st_ctime;
+ }
+ return 0;
+}
+
//============================================================================
// protected
//============================================================================
diff --git a/indra/llvfs/llvfs.h b/indra/llvfs/llvfs.h
index 39f31a221b..dca5ff4ad5 100644
--- a/indra/llvfs/llvfs.h
+++ b/indra/llvfs/llvfs.h
@@ -127,6 +127,7 @@ public:
void dumpStatistics();
void listFiles();
void dumpFiles();
+ time_t creationTime();
protected:
void removeFileBlock(LLVFSFileBlock *fileblock);