set_fg_root: prevent circumvention of the Nasal security code through
pre-setting and write-protecting /sim/fg-root in *-set.xml files
This commit is contained in:
parent
afc5225272
commit
88839f0b7a
1 changed files with 7 additions and 2 deletions
|
@ -169,7 +169,7 @@ FGGlobals::~FGGlobals()
|
||||||
// set the fg_root path
|
// set the fg_root path
|
||||||
void FGGlobals::set_fg_root (const string &root) {
|
void FGGlobals::set_fg_root (const string &root) {
|
||||||
fg_root = root;
|
fg_root = root;
|
||||||
|
|
||||||
// append /data to root if it exists
|
// append /data to root if it exists
|
||||||
SGPath tmp( fg_root );
|
SGPath tmp( fg_root );
|
||||||
tmp.append( "data" );
|
tmp.append( "data" );
|
||||||
|
@ -178,7 +178,12 @@ void FGGlobals::set_fg_root (const string &root) {
|
||||||
fg_root += "/data";
|
fg_root += "/data";
|
||||||
}
|
}
|
||||||
|
|
||||||
fgSetString("/sim/fg-root", fg_root.c_str());
|
// remove /sim/fg-root before writing to prevent hijacking
|
||||||
|
SGPropertyNode *n = fgGetNode("/sim", true);
|
||||||
|
n->removeChild("fg-root", 0, false);
|
||||||
|
n = n->getChild("fg-root", 0, true);
|
||||||
|
n->setStringValue(fg_root.c_str());
|
||||||
|
n->setAttribute(SGPropertyNode::WRITE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGGlobals::set_fg_scenery (const string &scenery) {
|
void FGGlobals::set_fg_scenery (const string &scenery) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue