summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2020-07-31 21:52:48 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2020-07-31 21:52:48 +0300
commit0a89498f51c74df12abe2fdca4325613582f2664 (patch)
tree4703e12ca0dd1441252f37fd140b3d804d00859f
parent970ce06b34bcf44e6c86ab045c738776cd94c8bd (diff)
Fix heap use after free in the doctest "main".
-rw-r--r--tests/test_main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 0d83c3ced3..b62ff60538 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -69,7 +69,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.