From 8be093ed671eaf58124ebfc0404d241ee56d64de Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 17 May 2019 14:26:07 +0100 Subject: [PATCH] Tolerate empty first lines. Change-Id: Ib9aaf82560fc3f5adaa97f40a3de5f3946c6f65d --- wsd/ClientSession.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index 596c1c757..df68df351 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -87,6 +87,12 @@ bool ClientSession::_handleInput(const char *buffer, int length) return false; } + if (tokens.size() < 1) + { + sendTextFrame("error: cmd=empty kind=unknown"); + return false; + } + LOOLWSD::dumpIncomingTrace(docBroker->getJailId(), getId(), firstLine); if (LOOLProtocol::tokenIndicatesUserInteraction(tokens[0])) @@ -97,7 +103,7 @@ bool ClientSession::_handleInput(const char *buffer, int length) } if (tokens[0] == "loolclient") { - if (tokens.size() < 1) + if (tokens.size() < 2) { sendTextFrame("error: cmd=loolclient kind=badprotocolversion"); return false;