Torque3D/Engine/source/core
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
..
ogg clamp value fix on vorbis decoding 2014-11-29 00:00:41 +01:00
stream Use fixed buffer size var when allocating return buffer from console. 2014-06-11 13:09:55 +04:00
strings Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
util Merge pull request #1035 from bpay/memfixes 2015-01-25 13:42:32 +01:00
bitMatrix.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
bitRender.cpp Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
bitRender.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
bitSet.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
bitVector.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
bitVector.h Fix BitVector copy constructor. 2013-06-21 14:22:49 +02:00
bitVectorW.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
color.cpp Initialize StockColors 2014-05-12 11:01:04 +02:00
color.h T2D style 'Stock colors' 2014-05-06 09:26:01 +02:00
crc.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
crc.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
dataChunker.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
dataChunker.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
dnet.cpp Merge pull request #1035 from bpay/memfixes 2015-01-25 13:42:32 +01:00
dnet.h Input event changes 2013-01-22 18:17:41 -05:00
fileio.h Rename Status enum for avoid conficts on Linux. 2014-04-06 22:14:19 +02:00
fileObject.cpp Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
fileObject.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
filterStream.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
filterStream.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
frameAllocator.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
frameAllocator.h Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
idGenerator.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
idGenerator.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
iTickable.cpp ITickable supports object deletion 2013-11-08 17:31:52 -05:00
iTickable.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
memVolume.cpp Rename Status enum for avoid conficts on Linux. 2014-04-06 22:14:19 +02:00
memVolume.h Rename Status enum for avoid conficts on Linux. 2014-04-06 22:14:19 +02:00
module.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
module.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
resizeStream.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
resizeStream.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
resource.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
resource.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
resourceManager.cpp Fixes after feedback from Luis. 2014-12-23 18:48:02 +11:00
resourceManager.h Remove namespace from header 2013-07-28 12:55:52 -05:00
stringBuffer.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
stringBuffer.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
stringTable.cpp Add profiling to StringTable. 2014-12-29 20:20:00 +11:00
stringTable.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
tagDictionary.cpp Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
tagDictionary.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
tAlgorithm.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
threadStatic.cpp Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
threadStatic.h Fixed thread statics. 2014-08-20 10:00:46 +10:00
tokenizer.cpp Resolve issue #163 2013-03-27 21:36:17 -04:00
tokenizer.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
tSimpleHashTable.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
tSparseArray.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
virtualMountSystem.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
virtualMountSystem.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
volume.cpp Added Sanity Check for out of memory 2014-11-04 06:49:09 -05:00
volume.h Rename Status enum for avoid conficts on Linux. 2014-04-06 22:14:19 +02:00