diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index 7d8f984a..8387975c 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -235,9 +235,12 @@ namespace sf::priv::CloseConnection(connection); - const char* name = reinterpret_cast(xcb_get_property_value(wmName.get())); - - windowManagerName = name; + // It seems the wm name string reply is not necessarily + // null-terminated. The work around is to get its actual + // length to build a proper string + const char* begin = reinterpret_cast(xcb_get_property_value(wmName.get())); + const char* end = begin + xcb_get_property_value_length(wmName.get()); + windowManagerName = sf::String::fromUtf8(begin, end); return true; }