1
1
mirror of synced 2025-02-12 08:32:57 +01:00

Added extra security for detecting fumen files

Making sure the file ends with .bin to avoid false positives
This commit is contained in:
Farewell_ 2024-11-11 16:16:16 +01:00
parent 2cf94175c5
commit 87b6044e53

View File

@ -149,6 +149,12 @@ EncryptFile (const std::string &input_file, const std::string &hex_key) {
bool bool
IsFumenEncrypted (const std::string &filename) { IsFumenEncrypted (const std::string &filename) {
// Check if the filename ends with ".bin"
if (filename.size() < 4 || filename.substr(filename.size() - 4) != ".bin") {
std::cout << "Not a Fumen file: " << filename << std::endl;
return true; // If it doesn't we return early, as the file we're seeing isn't a fumen !
}
std::ifstream file(filename, std::ios::binary); std::ifstream file(filename, std::ios::binary);
file.seekg (0x214, std::ios::beg); file.seekg (0x214, std::ios::beg);
std::vector<unsigned char> buffer (24); std::vector<unsigned char> buffer (24);