[Libreoffice-commits] online.git: Branch 'libreoffice-5-4' - wsd/FileServer.cpp

Pranav Kant pranavk at collabora.co.uk
Tue Jan 30 11:52:55 UTC 2018


 wsd/FileServer.cpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit d23691f0ad9520a483234043e09189b48a8173a6
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Jan 30 12:29:47 2018 +0100

    Explicit is better than implicit; avoid invalid mem access
    
    The form.get function is something like this:
    
    const std::string& get(const std::string& abc) { return abc; }
    
    passing a string literal implicitly gets converted to temporary
    std::string whose reference is then returned and used. This causes
    crash, atleast for me, on building online with GCC 7
    
    Change-Id: I09d0aeea57a3dbeeefd1bb28ff645723714aa6b4
    Reviewed-on: https://gerrit.libreoffice.org/46727
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 75c2147b7f774afccf55bb93f7fae79efb615361)
    Reviewed-on: https://gerrit.libreoffice.org/46730
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    (cherry picked from commit 0d4bc145ba957982194808a8f43688d01885f6c3)
    Reviewed-on: https://gerrit.libreoffice.org/48903
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 93820c4a..49e36b56 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -416,9 +416,11 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
     std::string preprocess = *getUncompressedFile(relPath);
 
     HTMLForm form(request, message);
-    const std::string& accessToken = form.get("access_token", "");
-    const std::string& accessTokenTtl = form.get("access_token_ttl", "");
+    const std::string accessToken = form.get("access_token", "");
+    const std::string accessTokenTtl = form.get("access_token_ttl", "");
     LOG_TRC("access_token=" << accessToken << ", access_token_ttl=" << accessTokenTtl);
+    const std::string accessHeader = form.get("access_header", "");
+    LOG_TRC("access_header=" << accessHeader);
 
     // Escape bad characters in access token.
     // This is placed directly in javascript in loleaflet.html, we need to make sure


More information about the Libreoffice-commits mailing list