1
0
Fork 0

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:
mfranz 2008-06-16 07:46:55 +00:00
parent afc5225272
commit 88839f0b7a

View file

@ -169,7 +169,7 @@ FGGlobals::~FGGlobals()
// set the fg_root path
void FGGlobals::set_fg_root (const string &root) {
fg_root = root;
// append /data to root if it exists
SGPath tmp( fg_root );
tmp.append( "data" );
@ -178,7 +178,12 @@ void FGGlobals::set_fg_root (const string &root) {
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) {