From a956750df9e0ffa9acfe594f63043352d2f22ffe Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Thu, 25 Jan 2024 15:21:57 +0000 Subject: [PATCH] fix(userspace/libsinsp): solve segfault when formatting string views Signed-off-by: Jason Dellaluce --- userspace/libsinsp/user.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userspace/libsinsp/user.cpp b/userspace/libsinsp/user.cpp index 532764ac81..48303cc02b 100644 --- a/userspace/libsinsp/user.cpp +++ b/userspace/libsinsp/user.cpp @@ -302,7 +302,7 @@ scap_userinfo *sinsp_usergroup_manager::add_user(const std::string &container_id scap_userinfo *sinsp_usergroup_manager::add_host_user(uint32_t uid, uint32_t gid, std::string_view name, std::string_view home, std::string_view shell, bool notify) { libsinsp_logger()->format(sinsp_logger::SEV_DEBUG, - "adding host user: name: %s", name); + "adding host user: name: %.*s", static_cast(name.length()), name.data()); scap_userinfo *retval{nullptr}; if (name.data() != nullptr) @@ -434,7 +434,7 @@ scap_groupinfo *sinsp_usergroup_manager::add_group(const string &container_id, i scap_groupinfo *sinsp_usergroup_manager::add_host_group(uint32_t gid, std::string_view name, bool notify) { libsinsp_logger()->format(sinsp_logger::SEV_DEBUG, - "adding host group: name: %s", name); + "adding host group: name: %.*s", static_cast(name.length()), name.data()); scap_groupinfo *gr = nullptr; if (name.data())