summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-04-11 22:09:32 +0200
committerJan Holesovsky <kendy@collabora.com>2017-04-12 08:09:23 +0200
commitb6aa51a1c5a2c6dad4b2d1044e59cb47da0d1d34 (patch)
tree48e4425795d8694525be14c129920e0c885858f9
parentc87c8db954454d5f64336d031ca3d08cb2084c1e (diff)
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@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 08989a12acbe0ca3e40130f4d4af11fdbdd4118d) Reviewed-on: https://gerrit.libreoffice.org/36441 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--wsd/ClientSession.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 2af75d211..d11406689 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)
{