From c878a89e959c6671ba2f7c95c8ef652b34f5d628 Mon Sep 17 00:00:00 2001 From: LC Date: Sat, 11 Jul 2026 17:25:23 -0400 Subject: [PATCH] Filesystem: Fix Absolute() on Windows sizeof(*Fill) will only ever be 1, so we wouldn't actually copy much of anything. --- FEXHeaderUtils/FEXHeaderUtils/Filesystem.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FEXHeaderUtils/FEXHeaderUtils/Filesystem.h b/FEXHeaderUtils/FEXHeaderUtils/Filesystem.h index 44c784d24..b00cc588c 100644 --- a/FEXHeaderUtils/FEXHeaderUtils/Filesystem.h +++ b/FEXHeaderUtils/FEXHeaderUtils/Filesystem.h @@ -391,7 +391,8 @@ inline char* Absolute(const char* Path, char Fill[PATH_MAX]) { std::error_code ec; const auto PathAbsolute = std::filesystem::absolute(Path, ec); if (!ec) { - strncpy(Fill, PathAbsolute.string().c_str(), sizeof(*Fill)); + auto end = PathAbsolute.string().copy(Fill, PATH_MAX - 1); + Fill[end] = '\0'; return Fill; }