From ac8e92af17118eb2612dae8fe697002bb837f9c7 Mon Sep 17 00:00:00 2001 From: "Ben \"root\" Anderson" Date: Sun, 9 Feb 2014 08:26:11 -0600 Subject: [PATCH] Bounds check directories. --- src/RageFileManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/RageFileManager.cpp b/src/RageFileManager.cpp index 7e783ad1d4..33d126b908 100644 --- a/src/RageFileManager.cpp +++ b/src/RageFileManager.cpp @@ -349,6 +349,12 @@ void RageFileManager::GetDirListing( const RString &sPath_, vector &Add { RString sPath = sPath_; NormalizePath( sPath ); + + // NormalizePath() calls CollapsePath() which will remove "dir/.." pairs. + // So if a "/.." is still present, they're trying to go below the mountpoint, + // which isn't valid. + if( sPath.find("/..") != std::string::npos ) + return; vector apDriverList; ReferenceAllDrivers( apDriverList );