SL-16637 Better validation of data in LLEstablishAgentCommunication

Do not set capability when disconnected, it creates new coroutines that will do nothing and region might be invalid resulting in a crash. Do not initilize LLWorld.
meow-7.2.2
Andrey Kleshchev 2022-01-12 23:21:52 +02:00
parent 1b90d81fdf
commit f3778f7fcc
1 changed files with 18 additions and 3 deletions

View File

@ -1195,6 +1195,16 @@ public:
virtual void post(ResponsePtr response, const LLSD& context, const LLSD& input) const
{
if (LLApp::isExiting())
{
return;
}
if (gDisconnected)
{
return;
}
if (!LLWorld::instanceExists())
{
return;
}
@ -1207,8 +1217,13 @@ public:
return;
}
LLHost sim(input["body"]["sim-ip-and-port"].asString());
LLHost sim(input["body"]["sim-ip-and-port"].asString());
if (sim.isInvalid())
{
LL_WARNS() << "Got EstablishAgentCommunication with invalid host" << LL_ENDL;
return;
}
LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(sim);
if (!regionp)
{
@ -1217,7 +1232,7 @@ public:
return;
}
LL_DEBUGS("CrossingCaps") << "Calling setSeedCapability from LLEstablishAgentCommunication::post. Seed cap == "
<< input["body"]["seed-capability"] << LL_ENDL;
<< input["body"]["seed-capability"] << " for region " << regionp->getRegionID() << LL_ENDL;
regionp->setSeedCapability(input["body"]["seed-capability"]);
}
};