diff --git a/Common/G2ProtocolHandler.cpp b/Common/G2ProtocolHandler.cpp index 325710d..3320b5d 100644 --- a/Common/G2ProtocolHandler.cpp +++ b/Common/G2ProtocolHandler.cpp @@ -89,6 +89,8 @@ bool CG2ProtocolHandler::readPackets(in_addr& incomingAddress, unsigned int& inc { m_type = GT_NONE; + incomingPort = 0; + // No more data? int length = m_socket.read(m_buffer, BUFFER_LENGTH, incomingAddress, incomingPort); if (length <= 0) diff --git a/ircDDBGateway/IRCDDBGatewayThread.cpp b/ircDDBGateway/IRCDDBGatewayThread.cpp index 4281e72..6892267 100644 --- a/ircDDBGateway/IRCDDBGatewayThread.cpp +++ b/ircDDBGateway/IRCDDBGatewayThread.cpp @@ -1054,7 +1054,8 @@ void CIRCDDBGatewayThread::processG2() default: //Probably someone punching a UDP hole to us, keep track of that - m_cache.updateGatewayG2(wxT(""), incomingAddress, incomingPort); + if(incomingPort > 0 && incomingPort < 65536) + m_cache.updateGatewayG2(wxT(""), incomingAddress, incomingPort); return; } }