From 03d01dc18987d9f080a4ff43dea7ac95ffdfa208 Mon Sep 17 00:00:00 2001 From: Yuri Victorovich Date: Fri, 31 May 2024 14:01:07 -0700 Subject: [PATCH] Fix crash in get_executable_filename on FreeBSD The std::vector object needs to have the element allocated in order to take its address. --- libs/core/prefix/src/find_prefix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/prefix/src/find_prefix.cpp b/libs/core/prefix/src/find_prefix.cpp index 6cca5fd6fd23..92374b9a2ebd 100644 --- a/libs/core/prefix/src/find_prefix.cpp +++ b/libs/core/prefix/src/find_prefix.cpp @@ -242,7 +242,7 @@ namespace hpx::util { { std::vector buf(cb); sysctl(mib, 4, &buf[0], &cb, nullptr, 0); - std::copy(&buf[0], &buf[cb], std::back_inserter(r)); + std::copy(buf.begin(), buf.end(), std::back_inserter(r)); } #else