From eedeb9e581468241fa01429468e882a22f9a8335 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Thu, 18 Jan 2024 16:53:08 +0100 Subject: [PATCH] Fix xr::instance::path_to_string --- client/xr/instance.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/xr/instance.cpp b/client/xr/instance.cpp index 7e7dd408..8b739285 100644 --- a/client/xr/instance.cpp +++ b/client/xr/instance.cpp @@ -151,9 +151,11 @@ std::string xr::instance::path_to_string(XrPath path) std::string s; CHECK_XR(xrPathToString(id, path, 0, &length, nullptr)); - s.resize(length); + s.resize(length - 1); // length includes the null terminator CHECK_XR(xrPathToString(id, path, length, &length, s.data())); + assert(s[length - 1] == '\0'); + return s; }