Commit graph

36 commits

Author SHA1 Message Date
Glenn Smith
6b024b21bf As suggested, extract strlen calls from sizes into variables so it isn't called twice 2018-03-08 20:59:40 -05:00
Glenn Smith
7fc60fbf59 Better to use strlcat and strlcpy and move them to the cpp file. Provided an implementation for platforms that don't support them (macOS only currently) 2018-03-08 00:45:24 -05:00
Glenn Smith
cd79088939 Let dStrncat use strncat because it's probably set up for that 2018-03-07 03:58:28 -05:00
Glenn Smith
a94e0c6d81 Cleaning up the checks 2018-03-06 02:37:42 -05:00
Glenn Smith
a94587af43 Use strncpy instead of strcpy because again, buffer overflows 2018-03-06 02:35:33 -05:00
Glenn Smith
1728fe39ad Use strncat instead of strcat to prevent some buffer overflows 2018-03-06 00:48:44 -05:00
Phillip Khandeliants
172391e1d3 Fixed V610: Undefined behavior
In an arithmetic expression, all the variables whose values can be represented with type 'int' will be promoted to this type. Therefore, the result of the '~mask' expression is a negative number. By the C++ standard, shifting a negative number to the left leads to an undefined behavior.
2017-04-27 12:13:05 +03:00
Areloch
26fd24fbab Removes bits of code and includes that are based on old 360, xbox and PS3 flags that are no longer needed. 2017-04-08 20:30:57 -05:00
Azaezel
c57b1a8b70 clang reports: unclear || + && and &+| mixes. 2016-10-14 17:26:13 -05:00
Anis
794f1b9536 Merge pull request #1532 from GarageGames/pr/1143
[CLONE] More consolefunctions #1143
2016-02-26 18:57:49 +01:00
Raul Ferriz
a5d34271f2 Fixed some minor compiler warnings on Linux 2015-06-28 22:29:23 +02:00
Ben Payne
f67a0353d0 Review fixes 2015-02-23 14:57:37 -05:00
Ben Payne
55ac3dca70 Fix assignment operator 2015-02-20 18:42:30 -05:00
Ben Payne
591253d5b5 Fix missing va_end's 2015-02-20 18:42:29 -05:00
Nathan Bowhay
2e7018bf68 Added type conversions to fix compile errors
Added two type conversions that were missing in order to fix some
compile errors.
2015-02-11 10:55:30 -08:00
Ben Payne
47950382f7 ...and update the profiler strings 2015-01-26 16:52:07 -05:00
Ben Payne
fcf52fb5e0 Rename the memory allocating versions to make prev error less likely
The behavior is different enough that these shouldn't be overloaded
with the non-allocating verions. Also makes it more obvious what is
going on to the caller.
2015-01-26 16:52:06 -05:00
Ben Payne
6e45643b28 Add descriptions 2015-01-26 16:52:04 -05:00
Ben Payne
2cc4801974 Remove a dead function 2015-01-26 16:52:03 -05:00
Ben Payne
7613fa0375 Remove unnecessary null termination
UTF16Cache::copyToBuffer() is already adding a null terminator
2015-01-26 16:52:02 -05:00
Ben Payne
e3bbc42925 Provide a safer version of convertUTF16toUTF8 2015-01-26 16:52:01 -05:00
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
Luis Anton Rebollo
6492028bb2 Merge pull request #1035 from bpay/memfixes
Memfixes
2015-01-25 13:42:32 +01:00
LuisAntonRebollo
3336bffad2 Changes for Linux. 2015-01-19 01:44:36 +01:00
Daniel Buckmaster
3ab048c5b0 Fixes after feedback from Luis.
* Made use of dStrIsEmpty in more locations (and fixed it :P)
 * Removed commented-out code
 * Corrected default params
 * Fixed some console warning formats
 * Removed tabs
 * Corrected setExtent API
2014-12-23 18:48:02 +11:00
Daniel Buckmaster
03f71a78c0 Added dStrIsEmpty and replaced some incorrect string comparisons. 2014-12-21 21:25:19 +11:00
Ben Payne
a10e6e99d4 Fix read past end of array 2014-12-11 18:22:14 -05:00
Daniel Buckmaster
33444e8a36 Added string functions from T2D. 2014-06-16 12:39:51 +10:00
Daniel Buckmaster
1702573b78 Merge pull request #612 from GarageGames/platform-type-consistency
Platform type consistency
2014-05-10 11:40:40 +10:00
Daniel Buckmaster
87d9e245b7 Merge remote-tracking branch 'smally/platform_type_consistency' into platform-type-consistency
Conflicts:
	Engine/source/platform/platformCPUCount.cpp
2014-04-04 13:43:25 +11:00
Azaezel
59c755b5e5 Minimal requisite alterations for development head as of 02APR2014 for compilation purposes on VS2013. 2014-04-02 15:09:07 -05:00
Thomas Fischer
29d7fe310d Merge pull request #583 from tdev/x64_basics
windows 64 bit basics
2014-03-18 00:51:58 +01:00
Thomas Fischer
6d8e0d7e25 refactored platform precompiler variable: TORQUE_OS_WIN{32,64,} 2014-03-15 15:10:14 +01:00
Thomas Fischer
502e346eb6 visual studio 2012 Level 4 warning fixes 2014-03-15 11:38:53 +01:00
cpusci
4c35fd37af Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
DavidWyand-GG
7dbfe6994d Engine directory for ticket #1 2012-09-19 11:15:01 -04:00