From 2ce455fc73c229b9a551e44648d028c65fc464ef Mon Sep 17 00:00:00 2001 From: noshbar Date: Wed, 9 Oct 2019 15:01:11 +0200 Subject: [PATCH] [Base] Initialize file 'open_access' flag before using it. In the 'OpenExisting' function, 'open_access' is used to create the flags for opening the file. However, it is not set to zero, so could end up being incorrect file modes, potentially even emptying the file for appending, which would be bad. This simply initialises it to zero first. --- src/xenia/base/filesystem_posix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xenia/base/filesystem_posix.cc b/src/xenia/base/filesystem_posix.cc index caf8219ad..f0ca77bf4 100644 --- a/src/xenia/base/filesystem_posix.cc +++ b/src/xenia/base/filesystem_posix.cc @@ -155,7 +155,7 @@ class PosixFileHandle : public FileHandle { std::unique_ptr FileHandle::OpenExisting(std::wstring path, uint32_t desired_access) { - int open_access; + int open_access = 0; if (desired_access & FileAccess::kGenericRead) { open_access |= O_RDONLY; }