You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2019/09/30 10:19:22 UTC

[commons-daemon] 01/08: Fix potential access to uninitialised variable

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git

commit 57cd31de7a110c258a3fea7112fa7545e2c134eb
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 30 10:14:03 2019 +0100

    Fix potential access to uninitialised variable
---
 src/native/windows/src/javajni.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/native/windows/src/javajni.c b/src/native/windows/src/javajni.c
index a7f874c..81c6580 100644
--- a/src/native/windows/src/javajni.c
+++ b/src/native/windows/src/javajni.c
@@ -852,10 +852,11 @@ apxJavaCmdInitialize(APXHANDLE hPool, LPCWSTR szClassPath, LPCWSTR szClass,
     *lppArray = (LPWSTR *)apxPoolAlloc(hPool, (nTotal + 2) * sizeof(LPWSTR));
 
     /* Process JVM options */
+    i = 0;
     if (nJVM && lJVM) {
         p = (LPWSTR)apxPoolAlloc(hPool, (lJVM + 1) * sizeof(WCHAR));
         AplCopyMemory(p, szOptions, (lJVM + 1) * sizeof(WCHAR) + sizeof(WCHAR));
-        for (i = 0; i < nJVM; i++) {
+        for (; i < nJVM; i++) {
             (*lppArray)[i] = p;
             while (*p)
                 p++;