[Libreoffice-commits] online.git: wsd/ClientSession.cpp

Miklos Vajna vmiklos at collabora.co.uk
Tue Apr 11 21:20:26 UTC 2017


 wsd/ClientSession.cpp |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 08989a12acbe0ca3e40130f4d4af11fdbdd4118d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Apr 11 22:09:32 2017 +0200

    wsd: avoid use-after-free in ClientSession
    
    Commit 1e1f23716c9ee3ce880d1d927945386cf5400293 fixed this already by
    introducing by-value parameters, but
    8a1f321c8492d6c2824317c7e4be1a3bdfa81665 broke it. Fix this again, this
    time more explicitly.
    
    Change-Id: If29250ac2e99855796935b5cc05ccb222f8a4ad5
    Reviewed-on: https://gerrit.libreoffice.org/36436
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 2af75d21..d1140668 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -523,7 +523,8 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
                 }
 
                 // Save to Storage and log result.
-                docBroker->saveToStorage(getId(), success, result);
+                std::string id = getId();
+                docBroker->saveToStorage(id, success, result);
                 return true;
             }
         }
@@ -604,7 +605,8 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
             LOG_TRC("Removing save-as ClientSession after conversion.");
 
             // Remove us.
-            docBroker->removeSession(getId());
+            std::string id = getId();
+            docBroker->removeSession(id);
 
             // Now terminate.
             docBroker->stop();
@@ -736,7 +738,8 @@ void ClientSession::onDisconnect()
 
         // We issue a force-save when last editable (non-readonly) session is going away
         // and defer destroying the last session and the docBroker.
-        docBroker->removeSession(getId(), true);
+        std::string id = getId();
+        docBroker->removeSession(id, true);
     }
     catch (const UnauthorizedRequestException& exc)
     {


More information about the Libreoffice-commits mailing list