[Libreoffice-commits] core.git: comphelper/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Aug 13 15:59:47 UTC 2017


 comphelper/source/windows/windows_process.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 26020c84ab10cd5c10b9a603b365d6107f1a5b21
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Aug 13 16:34:27 2017 +0200

    updater: fix crash on windows while creating the updater command line
    
    Change-Id: I606f5ede0fe70af4b30c68a10b7c400612fddaee
    Reviewed-on: https://gerrit.libreoffice.org/41115
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx
index 1c782d7a289f..b7fa19373dc2 100644
--- a/comphelper/source/windows/windows_process.cxx
+++ b/comphelper/source/windows/windows_process.cxx
@@ -135,7 +135,7 @@ MakeCommandLine(int argc, wchar_t **argv)
     int len = 0;
 
     // The + 1 of the last argument handles the allocation for null termination
-    for (i = 0; i < argc; ++i)
+    for (i = 0; i < argc && argv[i]; ++i)
         len += ArgStrLen(argv[i]) + 1;
 
     // Protect against callers that pass 0 arguments
@@ -147,7 +147,7 @@ MakeCommandLine(int argc, wchar_t **argv)
         return nullptr;
 
     wchar_t *c = s;
-    for (i = 0; i < argc; ++i)
+    for (i = 0; i < argc && argv[i]; ++i)
     {
         c = ArgToString(c, argv[i]);
         if (i + 1 != argc)


More information about the Libreoffice-commits mailing list