Using the 'setd' , set decimal value to property, command with this bad syntax ( the space delimiter is missing between property name and new value) :
client.print("setd controls/engines/engine/throttle");
client.print(cumlThrt);
client.print("\r\n");
causes a segfault at flightgear/src/Network/props.cxx @ 601:
tmp += tokens[2].c_str();
bea\cause there aren't three tokens. Rewriting that block of code to log an error prevents the segfault and logs an error message ( props.cxx @ 592 :
else if ( command == "setd" || command == "setf") {
std::string value, tmp;
if (tokens.size() == 3) {
node->getNode( tokens[1].c_str(), true )
->setDoubleValue(atof(tokens[2].c_str()));
if ( mode == PROMPT ) {
tmp = tokens[1].c_str();
tmp += " ";
tmp += tokens[2].c_str();
tmp += " (";
tmp += getValueTypeString( node->getNode( tokens[1].c_str() ) );
tmp += ")";
push( tmp.c_str() );
push( getTerminator() );
}
} else {
SG_LOG( SG_IO, SG_ALERT, "Network I/O setd / setf wrong token count" );
}
}
I'm guessing the following 'setb' block could be similarly modified.
Patch for the fix attached
Agreed, I'll apply.
Thank You !
Pushed some changes to FG git, please test.
Um, It looks like the change in NasalCondition is stopping a build here:
/fgfs/flightgear/src/Scripting/NasalCondition.hxx:24:32: error: 'function' in namespace 'std' does not name a tem a plate type a
24 | using NasalCallback = std::function<void(naref)>; a
| ^~~~~~~~ a
/fgfs/flightgear/src/Scripting/NasalCondition.hxx:9:1: note: 'std::function' is defined in header '<functional>'; a did you forget to '#include <functional>'? </functional></functional></void(naref)>
Added *include <functional>" in Scripting/NasalCondition.hxx fixed the build.
Tested set, setb, setd, setf, seti with good and bad arguments, telnet, all looks good, Thanks ! </functional>