1
0
Fork 0

Simplify Nasal security code

This commit is contained in:
Rebecca N. Palmer 2016-10-18 22:35:10 +01:00
parent 0a256038d3
commit 0ec47c9802
3 changed files with 9 additions and 7 deletions

View file

@ -472,6 +472,7 @@ void FGGlobals::append_aircraft_path(const SGPath& path)
}
fg_aircraft_dirs.push_back(dirPath.realpath());
extra_read_allowed_paths.push_back(dirPath.realpath());
}
void FGGlobals::append_aircraft_paths(const PathList& paths)

View file

@ -258,7 +258,13 @@ public:
void set_catalog_aircraft_path(const SGPath& path);
PathList get_aircraft_paths() const;
/**
* Add an aircraft directory
*
* This also makes the path Nasal-readable:
* to avoid can-read-any-file security holes, do NOT call this on paths
* obtained from the property tree or other Nasal-writable places
*/
void append_aircraft_path(const SGPath& path);
void append_aircraft_paths(const PathList& path);

View file

@ -93,12 +93,7 @@ void fgInitAllowedPaths()
read_allowed_paths.clear();
write_allowed_paths.clear();
const PathList& aircraft_paths = globals->get_aircraft_paths();
const PathList& other_read_paths = globals->get_extra_read_allowed_paths();
// not plain fg_scenery, to avoid making
// /sim/terrasync/scenery-dir a security hole
PathList read_paths = aircraft_paths;
read_paths.insert(read_paths.end(), other_read_paths.begin(), other_read_paths.end());
PathList read_paths = globals->get_extra_read_allowed_paths();
read_paths.push_back(globals->get_fg_root());
read_paths.push_back(globals->get_fg_home());