123649 r=mjudge sr=dveditz a=rjesup adt=putterman
fixes crasher in xpi_prepareprocessarguments
This commit is contained in:
Родитель
c7bec780af
Коммит
47d28142c0
|
@ -56,14 +56,14 @@ MOZ_DECL_CTOR_COUNTER(nsInstallExecute)
|
|||
//
|
||||
// Returns the count of the number of command-line arguments actually
|
||||
// stored into the array aArgs or -1 if it fails.
|
||||
PRInt32 xpi_PrepareProcessArguments(const nsString& aArgsString, char **aArgs, PRInt32 aArgsAvailable)
|
||||
PRInt32 xpi_PrepareProcessArguments(char *aArgsString, char **aArgs, PRInt32 aArgsAvailable)
|
||||
{
|
||||
int argc;
|
||||
char *c;
|
||||
char *p; // look ahead
|
||||
PRBool quoted = PR_FALSE;
|
||||
|
||||
aArgs[0] = ToNewCString(aArgsString);
|
||||
aArgs[0] = aArgsString;
|
||||
if (!aArgs[0])
|
||||
return -1;
|
||||
|
||||
|
@ -191,9 +191,12 @@ PRInt32 nsInstallExecute::Complete()
|
|||
|
||||
nsCOMPtr<nsIProcess> process = do_CreateInstance(kIProcessCID);
|
||||
|
||||
char *arguments = nsnull;
|
||||
if (!mArgs.IsEmpty())
|
||||
argcount = xpi_PrepareProcessArguments(mArgs, cArgs, ARG_SLOTS);
|
||||
|
||||
{
|
||||
arguments = ToNewCString(mArgs);
|
||||
argcount = xpi_PrepareProcessArguments(arguments, cArgs, ARG_SLOTS);
|
||||
}
|
||||
if (argcount >= 0)
|
||||
{
|
||||
result = process->Init(mExecutableFile);
|
||||
|
@ -218,13 +221,13 @@ PRInt32 nsInstallExecute::Complete()
|
|||
}
|
||||
else
|
||||
rv = nsInstall::UNEXPECTED_ERROR;
|
||||
|
||||
if(cArgs[0])
|
||||
Recycle(cArgs[0]);
|
||||
}
|
||||
else
|
||||
rv = nsInstall::UNEXPECTED_ERROR;
|
||||
|
||||
if(arguments)
|
||||
Recycle(arguments);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "nsInstall.h"
|
||||
#include "nsIDOMInstallVersion.h"
|
||||
|
||||
PRInt32 xpi_PrepareProcessArguments(const nsString& aArgsString, char **aArgs, PRInt32 aArgsAvailable);
|
||||
PRInt32 xpi_PrepareProcessArguments(char *aArgsString, char **aArgs, PRInt32 aArgsAvailable);
|
||||
|
||||
|
||||
class nsInstallExecute : public nsInstallObject
|
||||
|
|
|
@ -992,7 +992,9 @@ nsInstallFileOpItem::NativeFileOpFileExecuteComplete()
|
|||
#define ARG_SLOTS 256
|
||||
|
||||
char *cParams[ARG_SLOTS];
|
||||
char *arguments = nsnull;
|
||||
int argcount = -1;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
cParams[0] = nsnull;
|
||||
|
@ -1001,9 +1003,12 @@ nsInstallFileOpItem::NativeFileOpFileExecuteComplete()
|
|||
return nsInstall::INVALID_ARGUMENTS;
|
||||
|
||||
nsCOMPtr<nsIProcess> process = do_CreateInstance(kIProcessCID);
|
||||
|
||||
argcount = xpi_PrepareProcessArguments(*mParams, cParams, ARG_SLOTS);
|
||||
|
||||
|
||||
if (mParams && !mParams->IsEmpty())
|
||||
{
|
||||
arguments = ToNewCString(*mParams);
|
||||
argcount = xpi_PrepareProcessArguments(arguments, cParams, ARG_SLOTS);
|
||||
}
|
||||
if (argcount >= 0)
|
||||
{
|
||||
rv = process->Init(mTarget);
|
||||
|
@ -1014,8 +1019,8 @@ nsInstallFileOpItem::NativeFileOpFileExecuteComplete()
|
|||
else
|
||||
rv = nsInstall::UNEXPECTED_ERROR;
|
||||
|
||||
if(cParams[0])
|
||||
Recycle(cParams[0]);
|
||||
if(arguments)
|
||||
Recycle(arguments);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче