Fix bug in SvxReflector causing crash on restricted TG monitoring

The SvxReflector would sometimes crash when a node tried to set up a
monitor on a restricted talkgroup.
This commit is contained in:
Tobias Blomberg 2021-08-13 18:48:50 +02:00
parent 0bc9506f3a
commit e06b87de3d
2 changed files with 7 additions and 4 deletions

View File

@ -524,15 +524,18 @@ void ReflectorClient::handleTgMonitor(std::istream& is)
sendError("Illegal MsgTgMonitor protocol message received");
return;
}
std::set<uint32_t> tgs = msg.tgs();
for (auto it=tgs.begin(); it!=tgs.end(); ++it)
auto tgs = msg.tgs();
auto it = tgs.cbegin();
while (it != tgs.end())
{
if (!TGHandler::instance()->allowTgSelection(this, *it))
{
std::cout << m_callsign << ": Not allowed to monitor TG #"
<< *it << std::endl;
tgs.erase(it);
tgs.erase(it++);
continue;
}
++it;
}
cout << m_callsign << ": Monitor TG#: [ ";
std::copy(tgs.begin(), tgs.end(), std::ostream_iterator<uint32_t>(cout, " "));

View File

@ -37,4 +37,4 @@ DEVCAL=1.0.2.99.3
SVXSERVER=0.0.6
# Version for SvxReflector
SVXREFLECTOR=1.99.8
SVXREFLECTOR=1.99.9