diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-03-12 16:28:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-12 16:28:43 +0100 |
commit | 53131635b405d3417da55a3cd4c5e01c626210df (patch) | |
tree | e8c5b9f95078a5f07458403ed0eff83ebf41c135 | |
parent | fa416b34040a37403cde32a7632bd01e361eab92 (diff) | |
parent | 7822cc9329e8186668a12cf07126ce0ee40a21b7 (diff) |
Merge pull request #26962 from ibrahn/small-x11setcontext-fix
fix for access after free in OS_X11::set_context.
-rw-r--r-- | platform/x11/os_x11.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 87b63c0982..0fe91f3d00 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -3048,11 +3048,12 @@ void OS_X11::set_context(int p_context) { if (p_context == CONTEXT_ENGINE) { classHint->res_name = (char *)"Godot_Engine"; - char *config_name_tmp = (char *)((String)GLOBAL_GET("application/config/name")).utf8().ptrw(); - if (config_name_tmp) - config_name = strdup(config_name_tmp); - else + String config_name_tmp = GLOBAL_GET("application/config/name"); + if (config_name_tmp.length() > 0) { + config_name = strdup(config_name_tmp.utf8().get_data()); + } else { config_name = strdup("Godot Engine"); + } wm_class = config_name; } |