diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-30 17:05:56 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-01 22:06:11 -0500 |
commit | ae3a31795614000207470e6824887c414366a681 (patch) | |
tree | 7c3c659ee5efdbc7b4c7c93108221b229c26fd2d /src/burn/engine/embedded.cpp | |
parent | e7a208587389a17fa5ff3654d533e023268bfddf (diff) | |
download | wix-ae3a31795614000207470e6824887c414366a681.tar.gz wix-ae3a31795614000207470e6824887c414366a681.tar.bz2 wix-ae3a31795614000207470e6824887c414366a681.zip |
Minimize chance of user arguments messing up the command line
to avoid variations of issue 3890
Diffstat (limited to 'src/burn/engine/embedded.cpp')
-rw-r--r-- | src/burn/engine/embedded.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/burn/engine/embedded.cpp b/src/burn/engine/embedded.cpp index 1c295d59..58af5574 100644 --- a/src/burn/engine/embedded.cpp +++ b/src/burn/engine/embedded.cpp | |||
@@ -36,12 +36,13 @@ static HRESULT OnEmbeddedProgress( | |||
36 | // function definitions | 36 | // function definitions |
37 | 37 | ||
38 | /******************************************************************* | 38 | /******************************************************************* |
39 | EmbeddedLaunchChildProcess - | 39 | EmbeddedRunBundle - |
40 | 40 | ||
41 | *******************************************************************/ | 41 | *******************************************************************/ |
42 | extern "C" HRESULT EmbeddedRunBundle( | 42 | extern "C" HRESULT EmbeddedRunBundle( |
43 | __in LPCWSTR wzExecutablePath, | 43 | __in_z LPCWSTR wzExecutablePath, |
44 | __in LPCWSTR wzArguments, | 44 | __in_z LPWSTR sczBaseCommand, |
45 | __in_z_opt LPCWSTR wzUserArgs, | ||
45 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, | 46 | __in PFN_GENERICMESSAGEHANDLER pfnGenericMessageHandler, |
46 | __in LPVOID pvContext, | 47 | __in LPVOID pvContext, |
47 | __out DWORD* pdwExitCode | 48 | __out DWORD* pdwExitCode |
@@ -68,8 +69,15 @@ extern "C" HRESULT EmbeddedRunBundle( | |||
68 | hr = PipeCreatePipes(&connection, FALSE, &hCreatedPipesEvent); | 69 | hr = PipeCreatePipes(&connection, FALSE, &hCreatedPipesEvent); |
69 | ExitOnFailure(hr, "Failed to create embedded pipe."); | 70 | ExitOnFailure(hr, "Failed to create embedded pipe."); |
70 | 71 | ||
71 | hr = StrAllocFormattedSecure(&sczCommand, L"%ls -%ls %ls %ls %u", wzArguments, BURN_COMMANDLINE_SWITCH_EMBEDDED, connection.sczName, connection.sczSecret, dwCurrentProcessId); | 72 | hr = StrAllocFormatted(&sczCommand, L"%ls -%ls %ls %ls %u", sczBaseCommand, BURN_COMMANDLINE_SWITCH_EMBEDDED, connection.sczName, connection.sczSecret, dwCurrentProcessId); |
72 | ExitOnFailure(hr, "Failed to allocate embedded command."); | 73 | ExitOnFailure(hr, "Failed to append embedded args."); |
74 | |||
75 | // Always add user supplied arguments last. | ||
76 | if (wzUserArgs) | ||
77 | { | ||
78 | hr = StrAllocConcatFormattedSecure(&sczCommand, L" %ls", wzUserArgs); | ||
79 | ExitOnFailure(hr, "Failed to append user args."); | ||
80 | } | ||
73 | 81 | ||
74 | if (!::CreateProcessW(wzExecutablePath, sczCommand, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) | 82 | if (!::CreateProcessW(wzExecutablePath, sczCommand, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) |
75 | { | 83 | { |