Skip to content

Commit

Permalink
[rpcsx-os] shm: escape subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Nov 10, 2023
1 parent 1d3a394 commit 74aa1a1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rpcsx-os/iodev/shm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ orbis::ErrorCode ShmDevice::open(orbis::Ref<orbis::File> *file,
ORBIS_LOG_WARNING("shm_open", path, flags, mode);

std::string name = "/rpcsx-";
if (std::string_view{path}.starts_with("/")) {
if (path[0] == '/') {
name += path + 1;
} else {
name += path;
}

for (auto pos = name.find('/', 1); pos != std::string::npos; pos = name.find('/', pos + 1)) {
name[pos] = '$';
}

auto realFlags = O_RDWR; // TODO

std::size_t size = 0;
Expand Down

0 comments on commit 74aa1a1

Please sign in to comment.