From a829d0d58b8e568d0d159ccb1fcacb07d18ea944 Mon Sep 17 00:00:00 2001 From: EstexNT <66506310+EstexNT@users.noreply.github.com> Date: Tue, 17 Oct 2023 21:39:28 +0300 Subject: [PATCH] Fix a use-after-free in CreateProcessA (#54) Co-authored-by: Simon Lindholm --- dll/kernel32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index a5932a6..98e5dbc 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -214,7 +214,8 @@ namespace kernel32 { char **argv = (char **) calloc(argc + 1, sizeof(char*)); argv[0] = wibo::executableName; - argv[1] = (char *) files::pathFromWindows(lpApplicationName).string().c_str(); + std::string pathStr = files::pathFromWindows(lpApplicationName).string(); + argv[1] = (char *) pathStr.c_str(); char* arg = strtok(lpCommandLine, " "); size_t current_arg_index = 2;