From 684b7e2e6ae7ab8407b5c5db6a7e54f88f3175a5 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 11 May 2024 16:01:38 +0200 Subject: [PATCH] Added size check to injected files instead of attempting to load them all into memory --- es-app/src/FileData.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 36fb85bab..bd24fdcdb 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -1591,8 +1591,11 @@ void FileData::launchGame() std::string arguments; std::ifstream injectFileStream; injectFileStream.open(injectFile); - for (std::string line; getline(injectFileStream, line);) + for (std::string line; getline(injectFileStream, line);) { arguments += line; + if (arguments.size() > 4096) + break; + } injectFileStream.close(); if (arguments.empty()) { @@ -1602,8 +1605,7 @@ void FileData::launchGame() } else if (arguments.size() > 4096) { LOG(LogWarning) << "FileData::launchGame(): Injection file exceeding maximum " - "allowed size of " - "4096 bytes, skipping \"" + "allowed size of 4096 bytes, skipping \"" << injectFile << "\""; } else {