Torque3D/Engine/source/platformWin32
Ben Payne a88339c219 Fix buffer overflows due to incorrect use of sizeof
A snippet of example code:

UTF16 pszFilter[1024];
...
convertUTF8toUTF16((UTF8 *)mData.mFilters, pszFilter, sizeof(pszFilter));

Since the conversion function is expecting the third parameter to be the
length in 16-bit characters, *not* bytes, this results in the function
writing outside the bounds of the output array.

To make this less likely to happen in the future (I hope), I've provided a
template function that infers the correct size of a static array, so it's
no longer necessary to pass the size in most cases. The sized function has
been renamed with an "N" suffix to hopefully encourage this use.

This bug was caught due to a warning from MSVC about stack corruption
occurring in codeBlock::exec(), after opening a file open dialog twice in
succession. After some hunting, I found that this was due to
FileDialog::Execute() passing incorrect buffer sizes to the conversion
function, which resulted in the function writing a null terminator into
some memory that happened to be in the stack frame of codeBlock::exec()!
2015-01-26 16:52:01 -05:00
..
menus Merge pull request #1035 from bpay/memfixes 2015-01-25 13:42:32 +01:00
minidump Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
nativeDialogs Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
threads Merge remote-tracking branch 'smally/platform_type_consistency' into platform-type-consistency 2014-04-04 13:43:25 +11:00
videoInfo Support graphic cards with 2GB+ VRAM 2013-11-12 01:02:15 -05:00
cardProfile.cpp Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
platformWin32.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
VFSRes.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
win_common_prefix.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
win_debug_prefix.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
win_release_prefix.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winAsmBlit.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winAsync.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winConsole.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
winConsole.h Input event changes 2013-01-22 18:17:41 -05:00
winCPUInfo.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winDInputDevice.cpp Update for float, double and unsigned char, unsigned short, short, etc. char was left alone: read why here http://msdn.microsoft.com/en-us/library/cc953fe1.aspx 2013-08-04 16:58:59 -05:00
winDInputDevice.h Update for float, double and unsigned char, unsigned short, short, etc. char was left alone: read why here http://msdn.microsoft.com/en-us/library/cc953fe1.aspx 2013-08-04 16:58:59 -05:00
winDirectInput.cpp Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
winDirectInput.h Update for float, double and unsigned char, unsigned short, short, etc. char was left alone: read why here http://msdn.microsoft.com/en-us/library/cc953fe1.aspx 2013-08-04 16:58:59 -05:00
winDlibrary.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winExec.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
winFileio.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
winFont.cpp Minimal changes to compile T3D on WIN64. 2014-09-14 21:39:56 +02:00
winFont.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winInput.cpp Modified files for SDL2. 2015-01-18 22:52:29 +01:00
winMath.cpp Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
winMath_ASM.cpp Minimal changes to compile T3D on WIN64. 2014-09-14 21:39:56 +02:00
winMemory.cpp Minimal changes to compile T3D on WIN64. 2014-09-14 21:39:56 +02:00
winPlatformCPUCount.cpp Minimal changes to compile T3D on WIN64. 2014-09-14 21:39:56 +02:00
WinPlatformGL.cpp Add OpenGL support. 2014-11-08 20:21:50 +01:00
winProcessControl.cpp Linux implementation. Include changes for gcc x64. 2015-01-24 22:08:26 +01:00
winRedbook.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
winSemaphore.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winTime.cpp winTime month fix 2014-12-18 14:25:45 +10:00
winTimer.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winTLS.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winUser.cpp Minimal changes to compile T3D on WIN64. 2014-09-14 21:39:56 +02:00
winVFS.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
winVolume.cpp Rename Status enum for avoid conficts on Linux. 2014-04-06 22:14:19 +02:00
winVolume.h Rename Status enum for avoid conficts on Linux. 2014-04-06 22:14:19 +02:00
winWindow.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00