You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix OS::execute() and OS::create_process() command line argument CharStrings freed before use.
This commit is contained in:
@@ -299,10 +299,15 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St
|
|||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
// The child process
|
// The child process
|
||||||
Vector<char *> args;
|
Vector<CharString> cs;
|
||||||
args.push_back((char *)p_path.utf8().get_data());
|
cs.push_back(p_path.utf8());
|
||||||
for (int i = 0; i < p_arguments.size(); i++) {
|
for (int i = 0; i < p_arguments.size(); i++) {
|
||||||
args.push_back((char *)p_arguments[i].utf8().get_data());
|
cs.push_back(p_arguments[i].utf8());
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<char *> args;
|
||||||
|
for (int i = 0; i < cs.size(); i++) {
|
||||||
|
args.push_back((char *)cs[i].get_data());
|
||||||
}
|
}
|
||||||
args.push_back(0);
|
args.push_back(0);
|
||||||
|
|
||||||
@@ -335,10 +340,15 @@ Error OS_Unix::create_process(const String &p_path, const List<String> &p_argume
|
|||||||
// This ensures the process won't go zombie at the end.
|
// This ensures the process won't go zombie at the end.
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
Vector<char *> args;
|
Vector<CharString> cs;
|
||||||
args.push_back((char *)p_path.utf8().get_data());
|
cs.push_back(p_path.utf8());
|
||||||
for (int i = 0; i < p_arguments.size(); i++) {
|
for (int i = 0; i < p_arguments.size(); i++) {
|
||||||
args.push_back((char *)p_arguments[i].utf8().get_data());
|
cs.push_back(p_arguments[i].utf8());
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<char *> args;
|
||||||
|
for (int i = 0; i < cs.size(); i++) {
|
||||||
|
args.push_back((char *)cs[i].get_data());
|
||||||
}
|
}
|
||||||
args.push_back(0);
|
args.push_back(0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user