diff --git a/stepmania/src/CryptManager.cpp b/stepmania/src/CryptManager.cpp index 8f8ec2eef0..29d8c66e2a 100644 --- a/stepmania/src/CryptManager.cpp +++ b/stepmania/src/CryptManager.cpp @@ -3,6 +3,7 @@ #include "RageUtil.h" #include "RageLog.h" #include "PrefsManager.h" +#include "RageFileManager.h" // crypt headers #include "CryptHelpers.h" @@ -18,6 +19,7 @@ using namespace std; static const CString PRIVATE_KEY_PATH = "Data/private.rsa"; static const CString PUBLIC_KEY_PATH = "Data/public.rsa"; static const int KEY_LENGTH = 1024; +#define MAX_SIGNATURE_SIZE_BYTES 1024 // 1 KB CryptManager* CRYPTMAN = NULL; // global and accessable from anywhere in our program @@ -100,6 +102,10 @@ bool CryptManager::VerifyFileWithFile( CString sPath, CString sSignatureFile ) if( !IsAFile(sSignatureFile) ) return false; + int iBytes = FILEMAN->GetFileSizeInBytes( sSignatureFile ); + if( iBytes > MAX_SIGNATURE_SIZE_BYTES ) + return false; + try { RageFileSource pubFile(sPubFilename, true); RSASSA_PKCS1v15_SHA_Verifier pub(pubFile);