diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-21 20:59:04 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-21 20:59:04 +0000 |
commit | 0b3659b41a3f89e2e8016c7be6219a010646b3cf (patch) | |
tree | 69d65477aa50cc556c35fbddc1e86f8648a76011 /newgrf.c | |
parent | f8b652576526e39dad1b088e7d8c487300e7410b (diff) | |
download | openttd-0b3659b41a3f89e2e8016c7be6219a010646b3cf.tar.xz |
(svn r4510) - NewGRF bounds checking:
- check Engine ID is within range
- don't try setting a vehicle name if the string id is not a valid Engine ID
Diffstat (limited to 'newgrf.c')
-rw-r--r-- | newgrf.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1761,9 +1761,11 @@ static void VehicleNewName(byte *buf, int len) case GSF_TRAIN: case GSF_ROAD: case GSF_SHIP: - case GSF_AIRCRAFT: - SetCustomEngineName(id, AddGRFString(_cur_grffile->grfid, id, lang, name)); + case GSF_AIRCRAFT: { + StringID string = AddGRFString(_cur_grffile->grfid, id, lang, name); + if (id < TOTAL_NUM_ENGINES) SetCustomEngineName(id, string); break; + } #if 0 case GSF_STATION: |