wsd/ClientSession.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 23ff4c307debbc00d2cd03f7ef667b40723032ca Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu May 23 17:55:01 2019 +0100 Commit: Andras Timar <andras.ti...@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.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@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"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits