mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 04:29:09 +00:00
(svn r2965) Fix: newgrf: Add bounds checking to VehicleChangeInfo for vehicles and change
station special case to vehicle special case.
This commit is contained in:
9
newgrf.c
9
newgrf.c
@@ -1046,10 +1046,13 @@ static void VehicleChangeInfo(byte *buf, int len)
|
|||||||
return;
|
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]];
|
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;
|
buf += 5;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user