Merge pull request #5671 from birarda/ice-server-crash

don't read ice-server packets that are too small
This commit is contained in:
Seth Alves 2015-08-28 12:46:23 -07:00
commit 0ca9b60be5

View file

@ -55,6 +55,9 @@ void IceServer::processDatagrams() {
_serverSocket.readDatagram(buffer.get(), packetSizeWithHeader,
sendingSockAddr.getAddressPointer(), sendingSockAddr.getPortPointer());
// make sure that this packet at least looks like something we can read
if (packetSizeWithHeader >= Packet::localHeaderSize(PacketType::ICEServerHeartbeat)) {
auto packet = Packet::fromReceivedPacket(std::move(buffer), packetSizeWithHeader, sendingSockAddr);
PacketType::Value packetType = packet->getType();
@ -98,6 +101,7 @@ void IceServer::processDatagrams() {
}
}
}
}
}
SharedNetworkPeer IceServer::addOrUpdateHeartbeatingPeer(Packet& packet) {