diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-31 21:21:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 21:21:18 +0200 |
commit | 29df1919e1fe425dc6f9b68863c294cadd08a80e (patch) | |
tree | 8b483089767b510bad869b55afb78762c2edc655 /tests | |
parent | 92d39d1bd3e20c6d8bb20a8188016163e84955fe (diff) | |
parent | 0a89498f51c74df12abe2fdca4325613582f2664 (diff) |
Merge pull request #40928 from bruvzg/fix_test_heap_use_after_free
Fix heap use after free in the doctest "main".
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_main.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test_main.cpp b/tests/test_main.cpp index 06a5482a3d..89fe54f796 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -70,7 +70,8 @@ int test_main(int argc, char *argv[]) { char **args = new char *[valid_arguments.size()]; for (int x = 0; x < valid_arguments.size(); x++) { // Operation to convert Godot string to non wchar string. - const char *str = valid_arguments[x].utf8().ptr(); + CharString cs = valid_arguments[x].utf8(); + const char *str = cs.get_data(); // Allocate the string copy. args[x] = new char[strlen(str) + 1]; // Copy this into memory. |