Dont assert on external data

This commit is contained in:
Roland Winklmeier
2015-05-18 20:20:59 +02:00
parent 281b6f0b69
commit 7bc7b72c68
2 changed files with 3 additions and 1 deletions

View File

@@ -258,6 +258,7 @@ namespace BlackCore
if (h.contains(":"))
{
QStringList parts = h.split(":");
// todo: Replace assert with input validation
Q_ASSERT_X(parts.length() == 2, "p2pAdress", "Wrong IP string split");
h = parts.at(0).trimmed();
p = parts.at(1).trimmed();
@@ -267,6 +268,8 @@ namespace BlackCore
p = "45000";
}
}
// todo: Replace assert with input validation
Q_ASSERT_X(BlackMisc::CNetworkUtils::isValidIPv4Address(p), "p2pAdress", "Wrong IP in String");
QString p2p = QString("tcp:host=%1,port=%2").arg(h).arg(p);
return p2p;

View File

@@ -796,7 +796,6 @@ namespace BlackCore
int frequencyKHz = pos->frequency;
CFrequency freq(frequencyKHz, CFrequencyUnit::kHz());
freq.switchUnit(CFrequencyUnit::MHz()); // we would not need to bother, but this makes it easier to identify
Q_ASSERT(CComSystem::isValidCivilAviationFrequency(freq));
emit cbvar_cast(cbvar)->atcPositionUpdate(
CCallsign(cbvar_cast(cbvar)->fromFSD(callsign), CCallsign::Atc), freq,
CCoordinateGeodetic(pos->latitude, pos->longitude, 0), CLength(pos->visibleRange, CLengthUnit::NM()));