Permalink
Browse files

UI: Use a larger buffer for realpath().

Hopefully will prevent crashes on Mac.
  • Loading branch information...
unknownbrackets committed Aug 26, 2018
1 parent 200ec73 commit e9bc6b159dc91a9a2f84361caa65301e058c36f0
Showing with 5 additions and 3 deletions.
  1. +5 −3 Common/FileUtil.cpp
View
@@ -24,6 +24,7 @@
#include "ppsspp_config.h"
#include <memory>
#include "FileUtil.h"
#include "StringUtils.h"
@@ -152,11 +153,12 @@ std::string ResolvePath(const std::string &path) {
output = output.substr(4);
delete [] buf;
return output;
#else
char buf[PATH_MAX + 1];
if (realpath(path.c_str(), buf) == nullptr)
std::unique_ptr<char[]> buf(new char[PATH_MAX + 32768]);
if (realpath(path.c_str(), buf.get()) == nullptr)
return path;
return buf;
return buf.get();
#endif
}

0 comments on commit e9bc6b1

Please sign in to comment.