mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-02 17:28:33 +00:00
IOS HLE: More robust escaping of NAND paths
Prevents path traversal without needing an absolute path function, and also improves accuracy (character sequences like ../ appear to have no special meaning in IOS). This removes the creation and usage of /sys/replace, because the new escapes are too complicated to all be representable in its format and because no other NAND handling software seems to use /sys/replace.
This commit is contained in:
parent
de355a8521
commit
c74c317ab5
9 changed files with 90 additions and 88 deletions
|
@ -10,7 +10,9 @@
|
|||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <istream>
|
||||
#include <iterator>
|
||||
#include <limits.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -328,6 +330,21 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
|
|||
output.pop_back();
|
||||
}
|
||||
|
||||
std::string JoinStrings(const std::vector<std::string>& strings, const std::string& delimiter)
|
||||
{
|
||||
// Check if we can return early, just for speed
|
||||
if (strings.empty())
|
||||
return "";
|
||||
|
||||
std::stringstream res;
|
||||
std::copy(strings.begin(), strings.end(),
|
||||
std::ostream_iterator<std::string>(res, delimiter.c_str()));
|
||||
|
||||
// Drop the trailing delimiter.
|
||||
std::string joined = res.str();
|
||||
return joined.substr(0, joined.length() - delimiter.length());
|
||||
}
|
||||
|
||||
std::string TabsToSpaces(int tab_size, const std::string& in)
|
||||
{
|
||||
const std::string spaces(tab_size, ' ');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue