P2PServer: ignore protocol versions higher than supported

This commit is contained in:
SChernykh 2023-07-10 20:13:37 +02:00
parent 5b245e64d3
commit 6ffe1d81c2

View file

@ -2317,7 +2317,7 @@ void P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf)
// Check for protocol version message // Check for protocol version message
if ((*reinterpret_cast<uint32_t*>(ip.data + 12) == 0xFFFFFFFFU) && (port == 0xFFFF)) { if ((*reinterpret_cast<uint32_t*>(ip.data + 12) == 0xFFFFFFFFU) && (port == 0xFFFF)) {
m_protocolVersion = *reinterpret_cast<uint32_t*>(ip.data); m_protocolVersion = std::min(*reinterpret_cast<uint32_t*>(ip.data), SUPPORTED_PROTOCOL_VERSION);
m_SoftwareVersion = *reinterpret_cast<uint32_t*>(ip.data + 4); m_SoftwareVersion = *reinterpret_cast<uint32_t*>(ip.data + 4);
m_SoftwareID = *reinterpret_cast<uint32_t*>(ip.data + 8); m_SoftwareID = *reinterpret_cast<uint32_t*>(ip.data + 8);
LOGINFO(5, "peer " << log::Gray() << static_cast<char*>(m_addrString) << log::NoColor() LOGINFO(5, "peer " << log::Gray() << static_cast<char*>(m_addrString) << log::NoColor()