[Libreoffice-commits] core.git: include/LibreOfficeKit

Gabriel Herrera Gabriel.HerreraSanz at cib.de
Thu Apr 6 11:33:57 UTC 2017


 include/LibreOfficeKit/LibreOfficeKitInit.h |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0840bc7957117b8913e3d7d5848bbc4524b4949e
Author: Gabriel Herrera <Gabriel.HerreraSanz at cib.de>
Date:   Wed Apr 5 17:34:54 2017 +0200

    lokit: avoid null pointer access w/ undefined LOPath var
    
    Change-Id: I777fa58a138d453a108b0c65dcfd667d3da25999
    Reviewed-on: https://gerrit.libreoffice.org/36174
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 4dafe180cdb6..08b3e1c32947 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -121,12 +121,15 @@ extern "C"
         }
         //prepare the new PATH. Add the Ure/bin directory at the front.
         //note also adding ';'
-        char * sNewPath = new char[strlen(sEnvPath) + strlen(pPath) * 2 + strlen(UNOPATH) + 4];
+        size_t size_sEnvPath = 0;
+        if(sEnvPath)
+            size_sEnvPath = strlen(sEnvPath);
+        char* sNewPath = new char[size_sEnvPath + 2*strlen(pPath) + strlen(UNOPATH) + 4];
         sNewPath[0] = L'\0';
         strcat(sNewPath, pPath);     // program to PATH
         strcat(sNewPath, ";");
         strcat(sNewPath, UNOPATH);   // UNO to PATH
-        if (strlen(sEnvPath))
+        if (size_sEnvPath > 0)
         {
             strcat(sNewPath, ";");
             strcat(sNewPath, sEnvPath);


More information about the Libreoffice-commits mailing list