[ox/fs] Fix FileAddress paths initialized from StringView to null terminate

This commit is contained in:
Gary Talent 2022-11-30 20:48:09 -06:00
parent 1839b68a4a
commit 858a30ee08

View File

@ -30,8 +30,9 @@ FileAddress::FileAddress(uint64_t inode) noexcept {
FileAddress::FileAddress(ox::CRStringView path) noexcept { FileAddress::FileAddress(ox::CRStringView path) noexcept {
auto pathSize = path.bytes(); auto pathSize = path.bytes();
m_data.path = new char[pathSize]; m_data.path = new char[pathSize + 1];
memcpy(m_data.path, path.data(), pathSize); memcpy(m_data.path, path.data(), pathSize);
m_data.path[pathSize] = 0;
m_type = FileAddressType::Path; m_type = FileAddressType::Path;
} }