From e8a0762eee6acb724735cc6d08ffa28bb3f0a2a8 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 13 May 2017 09:56:23 -0400 Subject: [PATCH] Firestorm can't be trusted. --- indra/llvfs/lldir.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index 57f624895..84b173c3f 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -736,6 +736,15 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, << ((constraint == CURRENT_SKIN)? "CURRENT_SKIN" : "ALL_SKINS") << LL_ENDL; + // Build results vector. + std::vector 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." @@ -800,8 +809,6 @@ std::vector LLDir::findSkinnedFilenames(const std::string& subdir, } } - // Build results vector. - std::vector results; // The process we use depends on 'constraint'. if (constraint != CURRENT_SKIN) // meaning ALL_SKINS {