diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-09-08 22:53:20 +0000 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2007-09-08 22:53:20 +0000 |
commit | 5f3d9f1f80af84c71baed2fd9108aa1494ecaba5 (patch) | |
tree | b4ebcf124399766b776ef69a0e49e9f50920e514 /pages/content.ecpp | |
parent | 7813337cad75e71e76dbd1d4492ca0d53b523d61 (diff) | |
download | vdr-plugin-live-5f3d9f1f80af84c71baed2fd9108aa1494ecaba5.tar.gz vdr-plugin-live-5f3d9f1f80af84c71baed2fd9108aa1494ecaba5.tar.bz2 |
- Fixed bug #387. content.ecpp delivers only absolute path requests
without '..' in them.
Diffstat (limited to 'pages/content.ecpp')
-rw-r--r-- | pages/content.ecpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/pages/content.ecpp b/pages/content.ecpp index 9fdabf3..27d827c 100644 --- a/pages/content.ecpp +++ b/pages/content.ecpp @@ -23,21 +23,22 @@ if (request.getArgsCount() > 0) { reply.setContentType(mime); // dsyslog("vdrlive::content::mimetype(%s)", mime.c_str()); -// FileCache::ptr_type f = LiveFileCache().get("/tmp/live/" + request.getPathInfo()); string const path(request.getPathInfo()); - // dsyslog("vdrlive::content: path = %s", path.c_str()); -FileCache::ptr_type f; - -string const epgImgPath(LiveSetup().GetEpgImageDir()); -if (!epgImgPath.empty() && path.find(epgImgPath) != string::npos) { - f = LiveFileCache().get(path); +// security checking of path. In order to not allow exploits the +// path must be absolute and not contain any upward references (e.g '../') +if (path.empty()) { + return HTTP_BAD_REQUEST; } -else { - // dsyslog("vdrlive::content: retrieve from %s", Plugin::GetConfigDirectory().c_str()); - f = LiveFileCache().get(Plugin::GetConfigDirectory() + "/" + path); +if ('/' != path[0]) { + return HTTP_BAD_REQUEST; } +if (string::npos != path.find("../", 1)) { + return HTTP_BAD_REQUEST; +} + +FileCache::ptr_type f = LiveFileCache().get(path); if (f.get() == 0) { // dsyslog("vdrlive::content: DECLINED"); |