aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging/WheatyExceptionReport.cpp
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2017-07-16 18:16:48 +0200
committervincent-michael <vincent_michael@gmx.de>2017-07-16 21:14:22 +0200
commitfc6b488620282620eada92a6615643cdc9c5411f (patch)
tree09148ffe2578ac9d9e15088ca34caaec43a4df6a /src/common/Debugging/WheatyExceptionReport.cpp
parent74e4f73fcb7a2e14e9b2500f1630180defb0cfe9 (diff)
Core/Misc: Fix static analysis issues
# Conflicts: # src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp # src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp # src/server/game/Entities/Unit/Unit.cpp # src/server/scripts/Commands/cs_ban.cpp # src/server/scripts/Commands/cs_disable.cpp
Diffstat (limited to 'src/common/Debugging/WheatyExceptionReport.cpp')
-rw-r--r--src/common/Debugging/WheatyExceptionReport.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp
index 46192f33d34..266389bd4a7 100644
--- a/src/common/Debugging/WheatyExceptionReport.cpp
+++ b/src/common/Debugging/WheatyExceptionReport.cpp
@@ -129,7 +129,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
++pos;
TCHAR crash_folder_path[MAX_PATH];
- sprintf(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
+ sprintf_s(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder);
if (!CreateDirectory(crash_folder_path, NULL))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
@@ -1410,12 +1410,15 @@ int __cdecl WheatyExceptionReport::stackprintf(const TCHAR * format, va_list arg
int __cdecl WheatyExceptionReport::heapprintf(const TCHAR * format, va_list argptr)
{
- int retValue;
+ int retValue = 0;
DWORD cbWritten;
TCHAR* szBuff = (TCHAR*)malloc(sizeof(TCHAR) * WER_LARGE_BUFFER_SIZE);
- retValue = vsprintf(szBuff, format, argptr);
- WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0);
- free(szBuff);
+ if (szBuff != nullptr)
+ {
+ retValue = vsprintf(szBuff, format, argptr);
+ WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0);
+ free(szBuff);
+ }
return retValue;
}