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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 13 08:06:06 UTC 2019


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

New commits:
commit 23ff4c307debbc00d2cd03f7ef667b40723032ca
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu May 23 17:55:01 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Jun 13 10:05:48 2019 +0200

    Make renamefile more careful.
    
    Change-Id: If39353fc01ea48d8e0077b228a6281839dde5c87
    Reviewed-on: https://gerrit.libreoffice.org/72873
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index fd5e159ca..f3b970c79 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -216,8 +216,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");
@@ -369,9 +371,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