From 858a30ee0865a0e97c630531c968039d04bdef00 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 30 Nov 2022 20:48:09 -0600 Subject: [PATCH] [ox/fs] Fix FileAddress paths initialized from StringView to null terminate --- deps/ox/src/ox/fs/filesystem/filelocation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.cpp b/deps/ox/src/ox/fs/filesystem/filelocation.cpp index ccd207e8..3b6cb223 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.cpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.cpp @@ -30,8 +30,9 @@ FileAddress::FileAddress(uint64_t inode) noexcept { FileAddress::FileAddress(ox::CRStringView path) noexcept { auto pathSize = path.bytes(); - m_data.path = new char[pathSize]; + m_data.path = new char[pathSize + 1]; memcpy(m_data.path, path.data(), pathSize); + m_data.path[pathSize] = 0; m_type = FileAddressType::Path; }