From 08ae52710bd44bc6a132825d780a42a5996f1f5d Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 16 Jun 2025 18:38:55 +0200 Subject: [PATCH] Prevent translation of relative files --- src/windows-emulator/syscalls/file.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/windows-emulator/syscalls/file.cpp b/src/windows-emulator/syscalls/file.cpp index 0d9abfd2..55773b7d 100644 --- a/src/windows-emulator/syscalls/file.cpp +++ b/src/windows-emulator/syscalls/file.cpp @@ -958,7 +958,13 @@ namespace syscalls c.win_emu.callbacks.on_generic_access("Querying file attributes", filename); - const auto local_filename = c.win_emu.file_sys.translate(filename).u8string(); + windows_path filepath(filename); + if (filepath.is_relative()) + { + return STATUS_OBJECT_NAME_NOT_FOUND; + } + + const auto local_filename = c.win_emu.file_sys.translate(filepath).u8string(); struct _stat64 file_stat{}; if (_stat64(reinterpret_cast(local_filename.c_str()), &file_stat) != 0)