Enabling warnings around format security

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-09-07 15:17:40 -07:00
committed by GitHub
40 changed files with 152 additions and 266 deletions
+3 -12
View File
@@ -236,10 +236,7 @@ QString CEditorCommandManager::Execute(const AZStd::string& module, const AZStd:
}
else
{
QString errMsg;
errMsg = QStringLiteral("Error: Trying to execute a unknown command, '%1'!").arg(fullName.c_str());
CryLogAlways(errMsg.toUtf8().data());
CryLogAlways("Error: Trying to execute a unknown command, '%s'!", fullName.c_str());
}
return "";
@@ -272,10 +269,7 @@ QString CEditorCommandManager::Execute(const AZStd::string& cmdLine)
}
else
{
QString errMsg;
errMsg = QStringLiteral("Error: Trying to execute a unknown command, '%1'!").arg(cmdLine.c_str());
CryLogAlways(errMsg.toUtf8().data());
CryLogAlways("Error: Trying to execute a unknown command, '%s'!", cmdLine.c_str());
}
return "";
@@ -294,10 +288,7 @@ void CEditorCommandManager::Execute(int commandId)
}
else
{
QString errMsg;
errMsg = QStringLiteral("Error: Trying to execute a unknown command of ID '%1'!").arg(commandId);
CryLogAlways(errMsg.toUtf8().data());
CryLogAlways("Error: Trying to execute a unknown command of ID '%d'!", commandId);
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ void CConsoleDialog::SetInfoText(const char* text)
{
if (gEnv && gEnv->pLog) // before log system was initialized
{
CryLogAlways(text);
CryLogAlways("%s", text);
}
}
+3 -3
View File
@@ -67,7 +67,7 @@ SANDBOX_API void ErrorV(const char* format, va_list argList)
str += szBuffer;
//CLogFile::WriteLine( str );
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, str.toUtf8().data());
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "%s", str.toUtf8().data());
if (!CCryEditApp::instance()->IsInTestMode() && !CCryEditApp::instance()->IsInExportMode() && !CCryEditApp::instance()->IsInLevelLoadTestMode())
{
@@ -95,7 +95,7 @@ SANDBOX_API void WarningV(const char* format, va_list argList)
char szBuffer[MAX_LOGBUFFER_SIZE];
azvsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, format, argList);
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, szBuffer);
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, "%s", szBuffer);
bool bNoUI = false;
ICVar* pCVar = gEnv->pConsole->GetCVar("sys_no_crash_dialog");
@@ -478,7 +478,7 @@ void CLogFile::WriteString(const char* pszString)
{
if (gEnv && gEnv->pLog)
{
gEnv->pLog->LogPlus(pszString);
gEnv->pLog->LogPlus("%s", pszString);
}
}
+1 -1
View File
@@ -709,7 +709,7 @@ void CObjectManager::ShowDuplicationMsgWarning(CBaseObject* obj, const QString&
);
// If id is taken.
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, sRenameWarning.toUtf8().data());
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, "%s", sRenameWarning.toUtf8().data());
if (bShowMsgBox)
{
+1 -5
View File
@@ -24,11 +24,7 @@ PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam)
// Make sure the ffmpeg command can be executed before registering the command
if (!CFFMPEGPlugin::RuntimeTest())
{
AZStd::string msg =
"FFMPEG plugin: Failed to execute FFmepg. Please run Setup Assistant, "
"go to the 'Optional software' section of the 'Install software' tab, "
"and make sure the FFmpeg executable is correctly configured.";
GetIEditor()->GetSystem()->GetILog()->Log(msg.c_str());
GetIEditor()->GetSystem()->GetILog()->Log("FFMPEG plugin: Failed to execute FFmpeg. Please install FFmpeg.");
}
else
{
+1 -1
View File
@@ -313,7 +313,7 @@ namespace
{
if (strcmp(pMessage, "") != 0)
{
CryLogAlways(pMessage);
CryLogAlways("%s", pMessage);
}
}
@@ -719,8 +719,7 @@ bool CSequenceBatchRenderDialog::GetResolutionFromCustomResText(const char* cust
int scannedWidth = retCustomWidth; // initialize with default fall-back values - they'll be overwritten in the case of a succesful sscanf below.
int scannedHeight = retCustomHeight;
QString strFormat = QString::fromLatin1(customResFormat).replace(QRegularExpression(QStringLiteral("%\\d")), QStringLiteral("%d"));
scanSuccess = (azsscanf(customResText, strFormat.toStdString().c_str(), &scannedWidth, &scannedHeight) == 2);
scanSuccess = (azsscanf(customResText, "Custom(%d x %d)...", &scannedWidth, &scannedHeight) == 2);
if (scanSuccess)
{
retCustomWidth = scannedWidth;
+1 -1
View File
@@ -52,7 +52,7 @@ bool CImageASC::Save(const QString& fileName, const CFloatImage& image)
}
// First print the file header
fprintf(file, fileHeader.c_str());
fprintf(file, "%s", fileHeader.c_str());
// Then print all the pixels.
for (uint32 y = 0; y < height; y++)
+1 -1
View File
@@ -103,7 +103,7 @@ bool CImageUtil::SavePGM(const QString& fileName, const CImageEx& image)
}
// First print the file header
fprintf(file, fileHeader.c_str());
fprintf(file, "%s", fileHeader.c_str());
// Then print all the pixels.
for (uint32 y = 0; y < height; y++)
+1 -1
View File
@@ -78,7 +78,7 @@ bool CMemoryBlock::Allocate(int size, int uncompressedSize)
{
QString str;
str = QStringLiteral("CMemoryBlock::Allocate failed to allocate %1Mb of Memory").arg(size / (1024 * 1024));
CryLogAlways(str.toUtf8().data());
CryLogAlways("%s", str.toUtf8().data());
QMessageBox::critical(QApplication::activeWindow(), QString(), str + QString("\r\nSandbox will try to reduce its working memory set to free memory for this allocation."));
GetIEditor()->ReduceMemory();