summaryrefslogtreecommitdiffstats
path: root/wsd/FileServer.cpp
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-02-28 10:50:58 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-02-28 16:07:56 +0100
commitb8bd1990aaa1b063ca21b78ffec629b5d5ae7697 (patch)
tree15d21403ca3712252f2927d4826be0cad5b46461 /wsd/FileServer.cpp
parentloleaflet: makefile: avoid to execute javascript to get a list file (diff)
downloadonline-b8bd1990aaa1b063ca21b78ffec629b5d5ae7697.tar.gz
online-b8bd1990aaa1b063ca21b78ffec629b5d5ae7697.zip
Rework LOOLProtocol::tokenize() to return a StringVector object
The bulk of this commit just changes std::vector<std::string> to StringVector when we deal with tokens from a websocket message. The less boring part of it is the new StringVector class, which is a wrapper around std::vector<std::string>, and provides the same API, except that operator[] returns a string, not a string&, and this allows returning an empty string in case that prevents reading past the end of the underlying array. This means in case client code forgets to check size() before invoking operator[], we don't crash. (See the ~3 previous commits which fixed such crashes.) Later the ctor could be changed to take a single underlying string to avoid lots of tiny allocations, that's not yet done in this commit. Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'wsd/FileServer.cpp')
-rw-r--r--wsd/FileServer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 55942611e6..d7db1e80cd 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -145,7 +145,7 @@ bool isConfigAuthOk(const std::string& userProvidedUsr, const std::string& userP
#if HAVE_PKCS5_PBKDF2_HMAC
// Extract the salt from the config
std::vector<unsigned char> saltData;
- std::vector<std::string> tokens = LOOLProtocol::tokenize(securePass, '.');
+ StringVector tokens = LOOLProtocol::tokenize(securePass, '.');
if (tokens.size() != 5 ||
tokens[0] != "pbkdf2" ||
tokens[1] != "sha512" ||