aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/sdl_net/handlers/filespagehandler.cpp
diff options
context:
space:
mode:
authorAlexander Tkachev2016-08-01 14:55:58 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitacfa1d1f1069e4a4bbed8599d0e6b4e9b2ea37fe (patch)
treee9d57e3797ac334df20794c10bfec2a049e974b0 /backends/networking/sdl_net/handlers/filespagehandler.cpp
parentdd9e5a95dc5bbae20d3da05d638139120f3113f4 (diff)
downloadscummvm-rg350-acfa1d1f1069e4a4bbed8599d0e6b4e9b2ea37fe.tar.gz
scummvm-rg350-acfa1d1f1069e4a4bbed8599d0e6b4e9b2ea37fe.tar.bz2
scummvm-rg350-acfa1d1f1069e4a4bbed8599d0e6b4e9b2ea37fe.zip
CLOUD: Handle paths in marked places
Paths containing '../' are forbidden to use in Files Manager. There is also a special inner black list of paths which are not used and a check that specified path is under "savepath" or "rootpath" (from "cloud" domain).
Diffstat (limited to 'backends/networking/sdl_net/handlers/filespagehandler.cpp')
-rw-r--r--backends/networking/sdl_net/handlers/filespagehandler.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/backends/networking/sdl_net/handlers/filespagehandler.cpp b/backends/networking/sdl_net/handlers/filespagehandler.cpp
index 56b0551ed7..0bc9237805 100644
--- a/backends/networking/sdl_net/handlers/filespagehandler.cpp
+++ b/backends/networking/sdl_net/handlers/filespagehandler.cpp
@@ -81,17 +81,19 @@ bool FilesPageHandler::listDirectory(Common::String path, Common::String &conten
return true;
}
+ if (HandlerUtils::hasForbiddenCombinations(path))
+ return false;
+
Common::String prefixToRemove = "", prefixToAdd = "";
if (!transformPath(path, prefixToRemove, prefixToAdd))
return false;
- // TODO: handle <path>
-
Common::FSNode node = Common::FSNode(path);
if (path == "/")
node = node.getParent(); // absolute root
- // TODO: handle <path>
+ if (!HandlerUtils::permittedPath(node.getPath()))
+ return false;
if (!node.isDirectory())
return false;