X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoreauthhandler.cpp;h=34fc22276ebc5584e4a3c9e04301feb807956762;hp=e3809246002bcdd1b0b61825275a4597b493267f;hb=e67887343c433cc35bc26ad6a9392588f427e746;hpb=f64ac93b92faeb2fd8f9c411168e04e8501bd6e8 diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index e3809246..34fc2227 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -81,7 +81,7 @@ void CoreAuthHandler::onReadyRead() } // read the list of protocols supported by the client - while (socket()->bytesAvailable() >= 4) { + while (socket()->bytesAvailable() >= 4 && _supportedProtos.size() < 16) { // sanity check quint32 data; socket()->read((char*)&data, 4); data = qFromBigEndian(data); @@ -98,6 +98,12 @@ void CoreAuthHandler::onReadyRead() level = Compressor::NoCompression; RemotePeer *peer = PeerFactory::createPeer(_supportedProtos, this, socket(), level, this); + if (!peer) { + qWarning() << "Received invalid handshake data from client" << socket()->peerAddress().toString(); + close(); + return; + } + if (peer->protocol() == Protocol::LegacyProtocol) { _legacy = true; connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int)));