summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-04 00:07:58 +0000
committerdarkvater <darkvater@openttd.org>2005-01-04 00:07:58 +0000
commitd3454832c791fd7d9e31bbef8c5e107f3a83eaed (patch)
treeb817c62a9895c6f737a84ec73d1db3567db0b01f
parent08e1d8c896d3fede9698fbfc7925f53023a1934a (diff)
downloadopenttd-d3454832c791fd7d9e31bbef8c5e107f3a83eaed.tar.xz
(svn r1365) -Fix: very, very nasty buffer overflow bug introduced with replace vehicles. You CANNOT access the i[255] of an array that only has 255 elements! I will kick the next person that does that so hard...goddammit (I only noticed it because it screwed up my console in the debug build and took me at least an hour to fix)
-rw-r--r--misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index 3f6d337a3..a1bd0fc15 100644
--- a/misc.c
+++ b/misc.c
@@ -185,9 +185,9 @@ void InitializeGame()
{
// Initialize the autoreplace array. Needs to be cleared between each game
int i;
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < lengthof(_autoreplace_array); i++)
_autoreplace_array[i] = i;
- }
+
AddTypeToEngines(); // make sure all engines have a type
SetObjectToPlace(1, 0, 0, 0);