From a3554bda7021a7e376ab7fc8e0155f1482046f56 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 4 Mar 2019 17:35:38 +0200 Subject: [PATCH] - replaced all usages of insecure vsprintf() function --- src/posix/cocoa/i_system.mm | 2 +- src/posix/sdl/i_system.cpp | 2 +- src/sound/timidity/timidity.cpp | 2 +- src/win32/i_crash.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index e40202fc3..8ef18d985 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -180,7 +180,7 @@ void I_Error (const char *error, ...) va_start(argptr, error); - vsprintf (errortext, error, argptr); + myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr); va_end (argptr); throw CRecoverableError(errortext); } diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index 9303fc6eb..a9c94ba1f 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -229,7 +229,7 @@ void I_Error (const char *error, ...) va_start(argptr, error); - vsprintf (errortext, error, argptr); + myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr); va_end (argptr); throw CRecoverableError(errortext); } diff --git a/src/sound/timidity/timidity.cpp b/src/sound/timidity/timidity.cpp index b100a1e5d..22ec94d97 100644 --- a/src/sound/timidity/timidity.cpp +++ b/src/sound/timidity/timidity.cpp @@ -828,7 +828,7 @@ void cmsg(int type, int verbosity_level, const char *fmt, ...) char buf[1024]; va_list args; va_start(args, fmt); - vsprintf(buf, fmt, args); + myvsnprintf(buf, sizeof buf, fmt, args); va_end(args); I_DebugPrint(buf); #endif diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index 4918910ce..689e8a2b3 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -433,7 +433,7 @@ void Writef (HANDLE file, const char *format, ...) DWORD len; va_start (args, format); - len = vsprintf (buffer, format, args); + len = myvsnprintf (buffer, sizeof buffer, format, args); va_end (args); WriteFile (file, buffer, len, &len, NULL); }