(svn r22737) -Fix [FS#4717]: some corrupted savegames could crash OpenTTD instead of showing the "savegame corrupted" message
This commit is contained in:
@@ -126,7 +126,12 @@ static void Load_NAME()
|
||||
int index;
|
||||
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
if (index >= NUM_OLD_STRINGS) SlErrorCorrupt("Invalid old name index");
|
||||
if (SlGetFieldLength() > (uint)LEN_OLD_STRINGS) SlErrorCorrupt("Invalid old name length");
|
||||
|
||||
SlArray(&_old_name_array[LEN_OLD_STRINGS * index], SlGetFieldLength(), SLE_UINT8);
|
||||
/* Make sure the old name is null terminated */
|
||||
_old_name_array[LEN_OLD_STRINGS * index + LEN_OLD_STRINGS - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user