diff options
author | peter1138 <peter1138@openttd.org> | 2005-09-20 11:07:33 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2005-09-20 11:07:33 +0000 |
commit | 316944c1f5ae2ae6fd4ca574da25cdfbf324aceb (patch) | |
tree | 0f6fb9714f38a41015de406aab18b51ef596e0fa | |
parent | 5ba82c6da2bb9fce6a44c64876d00f8889b6a783 (diff) | |
download | openttd-316944c1f5ae2ae6fd4ca574da25cdfbf324aceb.tar.xz |
(svn r2965) Fix: newgrf: Add bounds checking to VehicleChangeInfo for vehicles and change
station special case to vehicle special case.
-rw-r--r-- | newgrf.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1046,10 +1046,13 @@ static void VehicleChangeInfo(byte *buf, int len) return; } - if (feature != GSF_STATION) + if (feature <= GSF_AIRCRAFT) { + if (engine + numinfo > _vehcounts[feature]) { + grfmsg(GMS_ERROR, "VehicleChangeInfo: Last engine ID %d out of bounds (max %d), skipping.", engine + numinfo, _vehcounts[feature]); + return; + } ei = &_engine_info[engine + _vehshifts[feature]]; - /* XXX - Should there not be a check to see if 'ei' is NULL - when it is used in the switch below?? -- TrueLight */ + } buf += 5; |