From dbc6f79366feb81da1f36de1508ed832f04a5b1c Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Thu, 31 Oct 2002 05:00:01 +0000 Subject: [PATCH] Bug 176543: handle the case of invoking a program wit no arguments. The command line should be an empty string in that case. Initialize newEnvp. The patch is contributed by Michael Kaply . --- nsprpub/pr/src/md/os2/os2misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nsprpub/pr/src/md/os2/os2misc.c b/nsprpub/pr/src/md/os2/os2misc.c index 250972af0b3..b3afa53dfa5 100644 --- a/nsprpub/pr/src/md/os2/os2misc.c +++ b/nsprpub/pr/src/md/os2/os2misc.c @@ -123,9 +123,9 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) /* * Find out how large the command line buffer should be. */ - cmdLineSize = 0; + cmdLineSize = 1; /* final null */ for (arg = argv+1; *arg; arg++) { - cmdLineSize += strlen(*arg) + 1; /* space in between, or final null */ + cmdLineSize += strlen(*arg) + 1; /* space in between */ } *cmdLine = PR_MALLOC(cmdLineSize); if (*cmdLine == NULL) { @@ -238,7 +238,7 @@ PRProcess * _PR_CreateOS2Process( { PRProcess *proc = NULL; char *cmdLine = NULL; - char **newEnvp; + char **newEnvp = NULL; char *envBlock = NULL; STARTDATA startData = {0};