[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - wsd/ClientSession.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu May 23 16:56:25 UTC 2019


 wsd/ClientSession.cpp |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 404b7f407e6d63c06129b7b43b5a5873b64be022
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu May 23 17:55:01 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu May 23 17:56:00 2019 +0100

    Make renamefile more careful.
    
    Change-Id: If39353fc01ea48d8e0077b228a6281839dde5c87

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 9c8a4cd2a..3de6a8651 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -221,8 +221,10 @@ bool ClientSession::_handleInput(const char *buffer, int length)
 
         return true;
     }
-    else if (tokens[0] == "versionrestore") {
-        if (tokens[1] == "prerestore") {
+    else if (tokens[0] == "versionrestore")
+    {
+        if (tokens.size() > 1 && tokens[1] == "prerestore")
+        {
             // green signal to WOPI host to restore the version *after* saving
             // any unsaved changes, if any, to the storage
             docBroker->closeDocument("versionrestore: prerestore_ack");
@@ -410,9 +412,10 @@ bool ClientSession::_handleInput(const char *buffer, int length)
         docBroker->broadcastMessage(firstLine);
         docBroker->removeSession(sessionId);
     }
-    else if (tokens[0] == "renamefile") {
+    else if (tokens[0] == "renamefile")
+    {
         std::string encodedWopiFilename;
-        if (!getTokenString(tokens[1], "filename", encodedWopiFilename))
+        if (tokens.size() < 2 || !getTokenString(tokens[1], "filename", encodedWopiFilename))
         {
             LOG_ERR("Bad syntax for: " << firstLine);
             sendTextFrame("error: cmd=renamefile kind=syntax");


More information about the Libreoffice-commits mailing list