mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added size check to injected files instead of attempting to load them all into memory
This commit is contained in:
parent
e30c2b5fa8
commit
684b7e2e6a
|
@ -1591,8 +1591,11 @@ void FileData::launchGame()
|
||||||
std::string arguments;
|
std::string arguments;
|
||||||
std::ifstream injectFileStream;
|
std::ifstream injectFileStream;
|
||||||
injectFileStream.open(injectFile);
|
injectFileStream.open(injectFile);
|
||||||
for (std::string line; getline(injectFileStream, line);)
|
for (std::string line; getline(injectFileStream, line);) {
|
||||||
arguments += line;
|
arguments += line;
|
||||||
|
if (arguments.size() > 4096)
|
||||||
|
break;
|
||||||
|
}
|
||||||
injectFileStream.close();
|
injectFileStream.close();
|
||||||
|
|
||||||
if (arguments.empty()) {
|
if (arguments.empty()) {
|
||||||
|
@ -1602,8 +1605,7 @@ void FileData::launchGame()
|
||||||
}
|
}
|
||||||
else if (arguments.size() > 4096) {
|
else if (arguments.size() > 4096) {
|
||||||
LOG(LogWarning) << "FileData::launchGame(): Injection file exceeding maximum "
|
LOG(LogWarning) << "FileData::launchGame(): Injection file exceeding maximum "
|
||||||
"allowed size of "
|
"allowed size of 4096 bytes, skipping \""
|
||||||
"4096 bytes, skipping \""
|
|
||||||
<< injectFile << "\"";
|
<< injectFile << "\"";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue