diff options
author | Gabriel Herrera <Gabriel.HerreraSanz@cib.de> | 2017-04-05 17:34:54 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-04-06 11:33:25 +0000 |
commit | 0840bc7957117b8913e3d7d5848bbc4524b4949e (patch) | |
tree | 24cadea457d2f5bae2120eb397ea990fa86739c7 /include/LibreOfficeKit | |
parent | 0c547776340c3983a867890b34f4a931215f8f52 (diff) |
lokit: avoid null pointer access w/ undefined LOPath var
Change-Id: I777fa58a138d453a108b0c65dcfd667d3da25999
Reviewed-on: https://gerrit.libreoffice.org/36174
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitInit.h | 7 |
1 files changed, 5 insertions, 2 deletions
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); |